Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion builtins/csg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

# hard-coded builtin, forked first from SOLID in early 2000s (first by a Blender developer, then by Timur)
# See https://github.com/root-project/root/blob/813cca51897056cd187a63f1e8b5a8a8601d7605/gl/src/CsgOps.cxx
# vs https://sourceforge.net/projects/solid/files/
# Upstream is now https://github.com/dtecta/solid3
# not yet in Debian https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500616

add_library(ROOTCsg STATIC)
target_sources(ROOTCsg PRIVATE src/CsgOps.cxx)
target_include_directories(ROOTCsg PUBLIC inc/)
target_link_libraries(ROOTCsg PRIVATE MathCore)
set_property(TARGET ROOTCsg PROPERTY POSITION_INDEPENDENT_CODE ON)
17 changes: 7 additions & 10 deletions builtins/csg/inc/CsgOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
#ifndef ROOT_CsgOps
#define ROOT_CsgOps

#include "RtypesCore.h"

class TBuffer3D;

namespace RootCsg {

// I need TBaseMesh to have an opaque pointer
Expand All @@ -18,14 +14,15 @@ class TBaseMesh {
TBaseMesh() = default;
virtual ~TBaseMesh() = default;

virtual UInt_t NumberOfPolys() const = 0;
virtual UInt_t NumberOfVertices() const = 0;
virtual UInt_t SizeOfPoly(UInt_t polyIndex) const = 0;
virtual const Double_t *GetVertex(UInt_t vertNum) const = 0;
virtual Int_t GetVertexIndex(UInt_t polyNum, UInt_t vertNum) const = 0;
virtual unsigned int NumberOfPolys() const = 0;
virtual unsigned int NumberOfVertices() const = 0;
virtual unsigned int SizeOfPoly(unsigned int polyIndex) const = 0;
virtual const double *GetVertex(unsigned int vertNum) const = 0;
virtual int GetVertexIndex(unsigned int polyNum, unsigned int vertNum) const = 0;
};

TBaseMesh *ConvertToMesh(const TBuffer3D &buff);
TBaseMesh *ConvertToMesh(double *pnts, const int *segs, const int *pols, unsigned int nbPnts, unsigned int nbSegs,
unsigned int nbPols);
TBaseMesh *BuildUnion(const TBaseMesh *leftOperand, const TBaseMesh *rightOperand);
TBaseMesh *BuildIntersection(const TBaseMesh *leftOperand, const TBaseMesh *rightOperand);
TBaseMesh *BuildDifference(const TBaseMesh *leftOperand, const TBaseMesh *rightOperand);
Expand Down
Loading
Loading