Boolean operations

Name

Boolean operations -- set operations between surfaces: union, intersection, difference.

Synopsis


#include <gts.h>


#define     GTS_SURFACE_INTER_CLASS         (klass)
#define     GTS_SURFACE_INTER               (obj)
#define     GTS_IS_SURFACE_INTER            (obj)
struct      GtsSurfaceInterClass;
struct      GtsSurfaceInter;

GSList*     gts_surface_intersection        (GtsSurface *s1,
                                             GtsSurface *s2,
                                             GNode *faces_tree1,
                                             GNode *faces_tree2);
GtsSurfaceInterClass* gts_surface_inter_class
                                            (void);
GtsSurfaceInter* gts_surface_inter_new      (GtsSurfaceInterClass *klass,
                                             GtsSurface *s1,
                                             GtsSurface *s2,
                                             GNode *faces_tree1,
                                             GNode *faces_tree2,
                                             gboolean is_open1,
                                             gboolean is_open2);
gboolean    gts_surface_inter_check         (GtsSurfaceInter *si,
                                             gboolean *closed);
enum        GtsBooleanOperation;
void        gts_surface_inter_boolean       (GtsSurfaceInter *si,
                                             GtsSurface *surface,
                                             GtsBooleanOperation op);
GtsSurface* gts_surface_is_self_intersecting
                                            (GtsSurface *s);

Description

The three-dimensional curve intersection of two surfaces is described by a GtsSurfaceInter object. This object contains additional information which allows to compute all the set operations between the two surfaces.

Details

GTS_SURFACE_INTER_CLASS()

#define     GTS_SURFACE_INTER_CLASS(klass)

Casts klass to GtsSurfaceInterClass.

klass :

a descendant of GtsSurfaceInterClass.


GTS_SURFACE_INTER()

#define     GTS_SURFACE_INTER(obj)

Casts obj to GtsSurfaceInter.

obj :

a descendant of GtsSurfaceInter.


GTS_IS_SURFACE_INTER()

#define     GTS_IS_SURFACE_INTER(obj)

Evaluates to TRUE if obj is a GtsSurfaceInter, FALSE otherwise.

obj :

a pointer to test.


struct GtsSurfaceInterClass

struct GtsSurfaceInterClass {

  GtsObjectClass parent_class;
};

The surface intersection class.


struct GtsSurfaceInter

struct GtsSurfaceInter {

  GtsObject object;

  GtsSurface * s1;
  GtsSurface * s2;
  GSList * edges;
};

The surface intersection object.

GtsObject object

Parent object.

GtsSurface *s1

Local triangulation of the intersecting faces of the first surface.

GtsSurface *s2

Local triangulation of the intersecting faces of the second surface.

GSList *edges

List of GtsEdge defining the 3D curve intersection of the two surfaces.


gts_surface_intersection ()

GSList*     gts_surface_intersection        (GtsSurface *s1,
                                             GtsSurface *s2,
                                             GNode *faces_tree1,
                                             GNode *faces_tree2);

s1 :

a GtsSurface.

s2 :

a GtsSurface.

faces_tree1 :

a bounding box tree (see gts_bb_tree_new()) for the faces of s1.

faces_tree2 :

a bounding box tree for the faces of s2.

Returns :

a list of GtsEdge defining the curve intersection of the two surfaces.


gts_surface_inter_class ()

GtsSurfaceInterClass* gts_surface_inter_class
                                            (void);

Returns :

the GtsSurfaceInterClass.


gts_surface_inter_new ()

GtsSurfaceInter* gts_surface_inter_new      (GtsSurfaceInterClass *klass,
                                             GtsSurface *s1,
                                             GtsSurface *s2,
                                             GNode *faces_tree1,
                                             GNode *faces_tree2,
                                             gboolean is_open1,
                                             gboolean is_open2);

When triangulating the cut faces, the new faces inherit the attributes of these original faces through their attributes() method.

klass :

a GtsSurfaceInterClass.

s1 :

a GtsSurface.

s2 :

a GtsSurface.

faces_tree1 :

a bounding box tree (see gts_bb_tree_new()) for the faces of s1.

faces_tree2 :

a bounding box tree for the faces of s2.

is_open1 :

whether s1 is an "open" surface.

is_open2 :

whether s2 is an "open" surface.

Returns :

a new GtsSurfaceInter describing the intersection of s1 and s2.


gts_surface_inter_check ()

gboolean    gts_surface_inter_check         (GtsSurfaceInter *si,
                                             gboolean *closed);

si :

a GtsSurfaceInter.

closed :

is set to TRUE if si->edges is a closed curve, FALSE otherwise.

Returns :

TRUE if the curve described by si is an orientable manifold, FALSE otherwise.


enum GtsBooleanOperation

typedef enum { GTS_1_OUT_2, 
	       GTS_1_IN_2, 
	       GTS_2_OUT_1, 
	       GTS_2_IN_1 }             GtsBooleanOperation;

GTS_1_OUT_2 identifies the part of the first surface which lies outside the second surface.

GTS_1_IN_2 identifies the part of the first surface which lies inside the second surface.

GTS_2_OUT_1 identifies the part of the second surface which lies outside the first surface.

GTS_2_IN_1 identifies the part of the second surface which lies inside the first surface.


gts_surface_inter_boolean ()

void        gts_surface_inter_boolean       (GtsSurfaceInter *si,
                                             GtsSurface *surface,
                                             GtsBooleanOperation op);

Adds to surface the part of the surface described by si and op.

si :

a GtsSurfaceInter.

surface :

a GtsSurface.

op :

a GtsBooleanOperation.


gts_surface_is_self_intersecting ()

GtsSurface* gts_surface_is_self_intersecting
                                            (GtsSurface *s);

s :

a GtsSurface.

Returns :

a new GtsSurface containing the faces of s which are self-intersecting or NULL if no faces of s are self-intersecting.