graph:subset-with-plane
List of: Scheme Extensions
Subjects: Graph Theory
Contents: Selective Booleans

Action: Finds the subset of a graph on one side of a plane.

Filename: sbool/sbool_scm/selective_scm.cxx

APIs: api_subset_graph_with_plane

Syntax: (graph:subset-with-plane whole-graph plane-origin


plane-normal [acis-opts])

Arg Types: whole-graph graph

plane-origin position

plane-normal vector

acis-opts acis-options

Returns: graph

Description: Finds the subset of a graph on one side of a plane. The graph must first be split at that plane. It is assumed that the graph is made of entities which are either faces or cells.


whole-graph is an input graph that is split to get a subset of the graph.


plane-origin is the position of the plane.


plane-normal is a vector to the plane.


The optional acis-opts contains parameters for versioning and journaling.

Example: ; graph:subset-with-plane

; Create entities

(define b1 (solid:block (position -40 0 0)


(position 40 10 10)))

;; b1

(define b2 (solid:block (position -40 10 0)


(position -30 30 10)))

;; b2

(define b3 (solid:block (position 30 10 0)


(position 40 30 10)))

;; b3

(define b4 (solid:block (position -5 0 0)


(position 5 30 10)))

;; b4

(define b5 (solid:block (position -35 15 0)


(position 35 25 10)))

;; b5

(define u1 (bool:unite b1 b2 b3))

;; u1

(define whole-entity (bool:nonreg-unite u1 b4 b5))

;; whole-entity

(cell:attach whole-entity)

;; (#[entity 7 1] #[entity 8 1] #[entity 9 1]

;; #[entity 10 1] #[entity 11 1] #[entity 12 1]

;; #[entity 13 1] #[entity 14 1] #[entity 15 1]

;; #[entity 16 1])

(define whole-graph (graph


(entity:cells whole-entity)))

;; whole-graph

(define plane-pos (position 5 0 0))

;; plane-pos

(define plane-normal1 (gvector 1 0 0))

;; plane-normal1

(define plane-normal2 (gvector:transform


plane-normal1 (transform:scaling -1)))

;; plane-normal2

(define partial-graph1 (graph:subset-with-plane


whole-graph plane-pos plane-normal1))

;; partial-graph1

(define partial-graph2 (graph:subset-with-plane


whole-graph plane-pos plane-normal2))

;; partial-graph2

; Make sure two halves have nothing in common.

(law:equal-test (graph:intersect


partial-graph1 partial-graph2) (graph ""))

;; #t

; Make sure two halves are both non-empty

(law:equal-test


(equal? partial-graph1 (graph "")) #f)

;; #t

(law:equal-test


(equal? partial-graph2 (graph "")) #f)

;; #t
PDF/SBOOL/02SC.PDF
HTM/DATA/SBOOL/SBOOL/02SC/0008.HTM