Scheme Extensions Fa thru Hz |
|
|
Technical Article |
in-face | face |
extra-info | boolean |
Description
Returns the number of control points in u and v.
; face:bs ; Create topology to demonstrate command. (define path (edge:spline (list (position 0 0 0) (position 10 0 0) (position 10 10 0)))) ;; path (define profile (edge:ellipse (position 0 0 0) (gvector 1 0 0) (gvector 0 0 1))) ;; profile (define pipe (sweep:law profile path)) ;; pipe (define face (list-ref (entity:faces pipe) 0)) ;; face ; Get the B-spline approximation information. (face:bs face) ;; (14 20) |
[Top]
face | entity |
Description
This returns text indicating how many of the various kinds of loops there
are in the given face and a Boolean flag indicating whether the check
was successful or not. Valid loop types include periphery loops, holes,
u-separation loops, v-separation loops, unknown loops, and
"Closed face, no loop".
; face:check ; Create a face. (define face1 (face:law "vec(cos(x), y, x)" -20 (law:eval "10*pi") -10 10)) ;; face1 (face:check face1) ; 1 periphery loop. ;; #t |
[Top]
object | scheme-object |
Description
This extension returns #t if the object is a conical face; otherwise, it
returns #f.
; face:conical? ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 5 0 0) (position 25 25 0) 30)) ;; cyl1 ; Get the faces of the cylinder. (define face-list (entity:faces cyl1)) ;; face-list ; Determine if the first face is a conical face. (face:conical? (car face-list)) ;; #t (face:conical? (car (cdr face-list))) ;; #f |
[Top]
entity | cylindrical-face |
Description
The returned ray is a gvector and position that specify the central axis
of the cylinder face supplied as the entity input. Note that the input
argument is cylinder face and not a solid:cylinder.
; face:cylinder-axis ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 8) 32)) ;; cyl1 ; Find the faces of the cylinder. (define faces1 (entity:faces cyl1)) ;; faces1 ; Determine the axis of a cylindrical face. (face:cylinder-axis (car faces1)) ;; #[ray (4 4 4) (0.57735 0.57735 0.57735)] |
[Top]
entity | cylindrical-face |
Description
The returned real specifies the radius of the cylinder face supplied as
the entity input. Note that the input argument is cylinder face and not
a solid:cylinder.
; face:cylinder-radius ; Create a cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 8) 32)) ;; cyl1 ; Find the faces of the cylinder. (define faces1 (entity:faces cyl1)) ;; faces1 ; (#[entity 3 1] #[entity 4 1] #[entity 5 1]) ; Find the radius of the cylindrical face. (face:cylinder-radius (car faces1)) ;; 32 |
[Top]
object | scheme-object |
Description
The returned boolean specifies whether the supplied entity input
is a cylindrical face. Note that the input argument is cylinder face and
not a solid:cylinder.
; face:cylindrical? ; Create a solid cylinder. (define cyl1 (solid:cylinder (position 0 0 0) (position 8 8 8) 32)) ;; cyl1 ; Find the faces of the cylinder. (define faces1 (entity:faces cyl1)) ;; faces1 ; Determine whether cyl1 is a cylindrical face. (face:cylindrical? cyl1) ;; #f ; Determine whether face 2 is a cylindrical face. (face:cylindrical? (car faces1)) ;; #t ; Determine whether face 3 is a cylindrical face. (face:cylindrical? (car (cdr faces1))) ;; #f |
[Top]
face | entity |
num-u | integer |
num-v | integer |
start-u | real |
end-u | real |
start-v | real |
end-v | real |
file | string |
Description
This Scheme extension tests the face quality by comparing the procedural
derivatives with finite difference derivatives up to the 4th derivatives.
Output message can be sent to a optional data file.
; face:derivtest ; Example not available at this time. |
[Top]
object | scheme-object |
Description
This extension returns #t if the specified object is a planar face.
; face:planar? ; Create a solid block. (define block1 (solid:block (position -10 -10 0) (position 25 25 25))) ;; block1 ; Get a list of the solid block's faces. (define faces1 (entity:faces block1)) ;; faces1 ; Determine if one of these faces is ; actually a planar face. (face:planar? (car (cdr (cdr faces1)))) ;; #t |
[Top]
entity | planar-face |
Description
This extension returns the normal of a planar face.
; face:plane-normal ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 40 40 40))) ;; block1 ; Get a list of the solid block's faces. (define faces1 (entity:faces block1)) ;; faces1 ; Get the normal of one of the planar faces. (face:plane-normal (car (cdr faces1))) ;; #[gvector 0 0 -1] ; Get the normal of another planar face. (face:plane-normal (car (cdr (cdr (cdr faces1))))) ;; #[gvector -1 0 0] |
[Top]
entity | planar-face |
Description
This extension represents the specified planar face as a ray.
; face:plane-ray ; Create a solid block. (define block1 (solid:block (position 0 0 0) (position 40 40 40))) ;; block1 ; Get a list of the solid block's faces. (define faces1 (entity:faces block1)) ;; faces1 ; Extract a plane from one of the faces and ; represent the face as a ray. (face:plane-ray (car (cdr faces1))) ;; #[ray (20 20 0) (0 0 -1)] ; Do the same with a second face. (face:plane-ray (car (cdr (cdr (cdr faces1))))) ;; #[ray (0 20 20) (-1 0 0)] |
[Top]
face | face | face ... |
body | body | body ... |
; face:scar? ; Create four types of face/edge geometry to ; demonstrate command. (define block1 (solid:block -40 -5 -15 -25 5 15)) ;; block1 (define edge (edge:linear (position -30 0 0) (position -30 0 10))) ;; edge (define body1 (hh:combine (list block1 edge))) ;; body1 (face:scar? block1) ;; () ; Create a planar disk. (define pdisk (face:planar-disk (position 0 0 0) (gvector 0 0 10) 10)) ;; pdisk (define disk-edge (edge:linear (position -10 0 0) (position 10 0 0))) ;; disk-edge (define body2 (hh:combine (list pdisk disk-edge))) ;; body2 (face:scar? body2) ;; () (define block2 (solid:block 20 10 0 30 20 40)) ;; block2 (define block2-edge (edge:linear (position 27 10 0) (position 22 15 20))) ;; block2-edge (define body3 (hh:combine (list block2 block2-edge))) ;; body3 (define cylinder (solid:cylinder (position -5 0 -14) (position -5 0 -34) 5)) ;; cylinder (define cyl-edge (edge:linear (position -3 5 -14) (position -3 5 -35))) ;; cyl-edge (define body4 (hh:combine (list cylinder cyl-edge))) ;; body4 Figure. face:scar? |
[Top]
face | spherical-face |
Description
This extension returns the position of the center of a spherical face.
; face:sphere-center ; Create a solid sphere. (define sphere1 (solid:sphere (position 0 0 0) 38)) ;; sphere1 ; Find the faces of the solid sphere. (define faces1 (entity:faces sphere1)) ;; faces1 ; Find the center of the spherical face. (face:sphere-center (car faces1)) ;; #[position 0 0 0] |
[Top]
face | spherical-face |
Description
This extension returns the radius of the spherical face.
; face:sphere-radius ; Create a solid sphere. (define sphere1 (solid:sphere (position 0 0 0) 38)) ;; sphere1 ; Find the faces of the solid sphere. (define faces1 (entity:faces sphere1)) ;; faces1 ; Find the radius of a spherical face. (face:sphere-radius (car faces1)) ;; 38 |
[Top]
object | scheme-object |
Description
This extension returns #t if the specified object is a spherical face.
; face:spherical? ; Create a solid sphere. (define sphere1 (solid:sphere (position 0 0 0) 20)) ;; sphere1 ; Determine if the solid sphere is a ; spherical face. (face:spherical? sphere1) ;; #f ; Find the faces of the solid sphere. (define faces1 (entity:faces sphere1)) ;; faces1 ; Determine if the face is actually a ; spherical face. (face:spherical? (car faces1)) ;; #t |
[Top]
object | scheme-object |
; face:spline? ; Define a spline edge 1. (define e1 (edge:spline (list (position 0 0 0) (position 20 -20 0) (position 20 0 0)))) ;; e1 ; Define linear edge 2. (define e2 (edge:linear (position 20 0 0) (position 20 20 0))) ;; e2 ; Define linear edge 3. (define e3 (edge:linear (position 20 20 0) (position 0 20 0))) ;; e3 ; Define linear edge 4. (define e4 (edge:linear (position 0 20 0) (position 0 0 0))) ;; e4 ; Define a wire body from ; the spline and linear edges. (define w (wire-body (list e1 e2 e3 e4))) ;; w ; Create a solid by sweeping ; a planar wire along a vector. (define ws (solid:sweep-wire w (gvector 0 0 20))) ;; ws ; Get the faces of the solid. (define edges1 (entity:faces ws)) ;; edges1 ; Determine if one of the faces is a spline face. (face:spline? (car (cdr edges1))) ;; #f ; Determine if another face is a spline face. (face:spline? (car (cdr (cdr (cdr edges1))))) ;; #t |
[Top]
object | scheme-object |
; face:toroidal? ; Create solid torus 1. (define torus1 (solid:torus (position -10 -10 -10) 7 3)) ;; torus1 ; Get a list of the faces on torus 1. (define faces1 (entity:faces torus1)) ;; faces1 ; Determine if the face is a toroidal face. (face:toroidal? (car faces1)) ;; #t |
[Top]
face1 | entity |
Description
This returns a string that tells what type of face has been produced.
Output strings include "Plane", "Cylinder", "Cone", "Sphere", "Torus",
"Spline", and "Unknown type". When the face is a spline, it also returns
the subtype for the spline.
; face:type ; Create a face. (define face1 (face:law "vec (cos (x), y, x)" -20 (law:eval "10*pi") -10 10)) ;; face1 (face:type face1) ;; "Spline surface (lawsur-spline)" |
[Top]
None |
; face:types ; create a solid cylinder (define cylinder (solid:cylinder (position 0 0 0) (position 0 0 30) 10)) ;; cylinder ; request a list of all faces in current part (face:types) ; entity:(entity 1 1) ; face:(entity 4 1) face-type:Cylinder ; face:(entity 5 1) face-type:Plane ; face:(entity 6 1) face-type:Plane ;; #t |
[Top]
object | scheme-object |
Description
The extension returns #t if the object is a face; otherwise, it returns
#f.
; face? ; Create a solid block. (define block1 (solid:block (position -10 -5 -15) (position 10 5 15))) ;; block1 ; Get the block's faces. (define faces1 (entity:faces block1)) ;; faces1 (face? block1) ;; #f ; Determine if face 2 is a face. (face? (car (cdr faces1))) ;; #t |
[Top]
filt1 | entity-filter |
filtn | entity-filter |
Description
Multiple filters can be combined using the Boolean and filter to form
a single filter that can be applied to a single entity or a list of entities.
An entity is selected if all parts of the combined filter return #t.
; filter:and ; Create solid block 1. (define block1 (solid:block (position 10 0 10) (position 20 30 40))) ;; block1 ; Create linear edge 2. (define edge1 (edge:linear (position 0 0 0) (position 10 10 10))) ;; edge1 ; Create circular edge 3. (define edge2 (edge:circular (position 0 0 0) 20)) ;; edge2 ; Change the color of the existing entities to red. (entity:set-color (part:entities) 1) ;; () ; Create solid sphere 4. (define sphere1 (solid:sphere (position 20 30 40) 30)) ;; sphere1 ; Create solid sphere 5. (define cyl1 (solid:cylinder (position 40 0 0) (position 5 5 5) 8)) ;; cyl1 ; Create linear edge 6. (define edge3 (edge:linear (position 0 50 0) (position 50 50 0))) ;; edge3 ; Create spline edge 7. (define edge4 (edge:spline (list (position 20 20 20) (position 10 20 30) (position 50 40 10)))) ;; edge4 ; Define a filter for red curves. (define red-curves (filter:and (filter:color 1) (filter:type "edge:circular?"))) ;; red-curves ; List the red curve entities. (filter:apply red-curves (part:entities)) ;; (#[entity 4 1]) ; The following accomplishes the same thing. (part:entities red-curves) ;; (#[entity 4 1]) |
[Top]
filter | entity-filter |
entity-or-list | entity | (entity ...) |
Description
Once a filter is created, the filter can be applied to obtain the particular
results. For example, if numerous entities are components of a part of
various colors, applying a color filter to the list of entities returns
the list of entities that match the filter's color. When applying the
filter to an entity that does not meet the requirements for the filter,
this extension returns the empty list.
; filter:apply ; Create solid block 1. (define block1 (solid:block (position 10 0 10) (position 20 30 40))) ;; block1 ; Create linear edge 2. (define edge1 (edge:linear (position 0 0 0) (position 10 10 10))) ;; edge1 ; Create circular edge 3. (define edge2 (edge:circular (position 0 0 0) 20)) ;; edge2 ; Change the color of the entities so far to red. (entity:set-color (part:entities) 1) ;; () ; Create solid sphere 4. (define sphere1 (solid:sphere (position 20 30 40) 30)) ;; sphere1 ; Create solid sphere 5. (define cyl1 (solid:cylinder (position 40 0 0) (position 5 5 5) 8)) ;; cyl1 ; Create linear edge 6. (define edge3 (edge:linear (position 0 50 0) (position 50 50 0))) ;; edge3 ; Create spline edge 7. (define edge4 (edge:spline (list (position 20 20 20) (position 10 20 30) (position 50 40 10)))) ;; edge4 ; Apply a green filter and obtain the entities. (filter:apply (filter:color 2) (part:entities)) ;; (#[entity 5 1] #[entity 6 1] ;; #[entity 7 1] #[entity 8 1]) ; Apply a solid, red filter and obtain the entities. (filter:apply (filter:and (filter:type "solid?") (filter:color 1)) (part:entities)) ;; (#[entity 2 1]) ; Apply a solid, green filter and ; obtain the entities. (part:entities (filter:type "solid?")) ;; (#[entity 2 1] #[entity 5 1] #[entity 6 1]) (filter:apply (filter:type "solid?") edge1) ;; () |
[Top]
filter | entity-filter |
; filter:not ; Create solid block 1. (define block1 (solid:block (position 10 0 10) (position 20 30 40))) ;; block1 ; Create linear edge 2. (define edge1 (edge:linear (position 0 0 0) (position 10 10 10))) ;; edge1 ; Create circular edge 3. (define edge2 (edge:circular (position 0 0 0) 20)) ;; edge2 ; Change the color of the entities so far to red. (entity:set-color (part:entities) 1) ;; () ; Create solid sphere 4. (define sphere1 (solid:sphere (position 20 30 40) 30)) ;; sphere1 ; Create solid sphere 5. (define cyl1 (solid:cylinder (position 40 0 0) (position 5 5 5) 8)) ;; cyl1 ; Create linear edge 6. (define edge3 (edge:linear (position 0 50 0) (position 50 50 0))) ;; edge3 ; Create spline edge 7. (define edge4 (edge:spline (list (position 20 20 20) (position 10 20 30) (position 50 40 10)))) ;; edge4 ; Apply a green filter and obtain the entities. (filter:apply (filter:color 2) (part:entities)) ;; (#[entity 5 1] #[entity 6 1] #[entity 7 1] ;; #[entity 8 1]) ; Define a yes-red filter. (define yes-red (filter:color 1)) ;; yes-red (part:entities yes-red) ;; (#[entity 1 1] #[entity 2 1] ;; #[entity 3 1] #[entity 4 1]) ; Define a not-red filter. (define not-red (filter:not (filter:color 1))) ;; not-red ; Apply a not-red filter and obtain the entities. (part:entities not-red) ;; (#[entity 5 1] #[entity 6 1] #[entity 7 1] ;; #[entity 8 1]) |
[Top]
filt1 | entity-filter |
filtn | entity-filter |
Description
Multiple filters can be combined using the Boolean or filter to form
a single filter that can be applied to a single entity or a list of entities.
An entity will be selected if at least one part of the combined filter
returns #t.
; filter:or ; Create solid block 1. (define block1 (solid:block (position 10 0 10) (position 20 30 40))) ;; block1 ; Create linear edge 2. (define edge1 (edge:linear (position 0 0 0) (position 10 10 10))) ;; edge1 ; Create circular edge 3. (define edge2 (edge:circular (position 0 0 0) 20)) ;; edge2 ; Change the color of the entities so far to red. (entity:set-color (part:entities) 1) ;; () ; Create solid sphere 4. (define sphere1 (solid:sphere (position 20 30 40) 30)) ;; sphere1 ; Create solid sphere 5. (define cyl1 (solid:cylinder (position 40 0 0) (position 5 5 5) 8)) ;; cyl1 ; Create linear edge 6. (define edge3 (edge:linear (position 0 50 0) (position 50 50 0))) ;; edge3 ; Create spline edge 7. (define edge4 (edge:spline (list (position 20 20 20) (position 10 20 30) (position 50 40 10)))) ;; edge4 ; Define the green-or-solid filter. (define green-or-solid (filter:or (filter:color 2) (filter:type "solid?"))) ;; green-or-solid ; Apply a green-or-solid filter and ; obtain the entities. (part:entities green-or-solid) ;; (#[entity 2 1] #[entity 5 1] #[entity 6 1] ;; #[entity 7 1] #[entity 8 1]) |
[Top]
type-name | string |
Description
This extension creates the specified type-name as a filter, which specifies
the type of entity to be used in another filter operation.
If a new type filter is created, it replaces the previously-defined type.
Refer to filter:color for creating filters based on color, and filter:types to display the list of available filter types.
; filter:type ; Create a solid block. (define part1 (solid:block (position 10 0 10) (position 20 30 40))) ;; part1 ; Create linear edge. (define part2 (edge:linear (position 0 0 0) (position 10 10 10))) ;; part2 ; Create circular edge. (define part3 (edge:circular (position 0 0 0) 20)) ;; part3 ; Change the color of the existing entities to red. (entity:set-color (part:entities) 1) ;; () ; Create solid sphere. (define part4 (solid:sphere (position 20 30 40) 30)) ;; part4 ; Create solid cylinder. (define part5 (solid:cylinder (position 40 0 0) (position 5 5 5) 8)) ;; part5 ; Create another linear edge. (define part6 (edge:linear (position 0 50 0) (position 50 50 0))) ;; part6 ; Create a spline edge. (define part7 (edge:spline (list (position 20 20 20) (position 10 20 30) (position 50 40 10)))) ;; part7 ; Get a list of available filter types. (filter:types) ;; ("point?" "vertex?" "text?" "wcs?" "face:spline?" ;; "face:toroidal?" "face:conical?" ;; "face:cylindrical?" "face:spherical?" ;; "face:planar?" "face?" "wire?" "mixed-body?" ;; "wire-body?" "solid?" "body?" "edge?" ;; "edge:spline?" "edge:elliptical?" ;; "edge:circular?" "edge:linear?" "edge:curve?") ; Apply a solid filter and get entities. (part:entities (filter:type "solid?")) ;; (#[entity 2 1] #[entity 5 1] #[entity 6 1]) ; Apply edge:spline filter and get entities. (part:entities (filter:type "edge:spline?")) ;; (#[entity 8 1]) |
[Top]
None |
Description
This extension returns all the valid filter types as a list of strings.
; filter:types ; Get a list of available filter types. (filter:types) ;; ("point?" "vertex?" "text?" "wcs?" "face:spline?" ;; "face:toroidal?" "face:conical?" ;; "face:cylindrical?" "face:spherical?" ;; "face:planar?" "face?" "wire?" "mixed-body?" ;; "wire-body?" "solid?" "body?" "edge?" ;; "edge:spline?" "edge:elliptical?" ;; "edge:circular?" "edge:linear?" "edge:curve?") |
[Top]
input1 | vertex | edge | wire-body |
input2 | edge |
logical | real |
Description
Success is not guaranteed for branched wire-bodies, edges that do not
share a vertex, and vertices with more than two edges.
; find:angle ; Create an entity (define p1 (wire-body:polygon (position 0 0 0) (gvector 0 1 0) (gvector 0 0 1) 5)) ;; p1 (define p2 (wire-body:polygon (position 0 2 0) (gvector 0 -1 0) (gvector 0 0 1) 5)) ;; p2 (define unite (bool:unite p1 p2)) ;; unite (zoom-all) ;; #[view 25363466] (define v (list-ref (entity:vertices p1)3)) ;; v (entity:set-color v 1) ;; () (find:angle v) ;; 108.0 |
[Top]
seed | entity |
return-type | string |
no-cross-list | entity | (entity ...) |
show-loop | boolean |
Description
Finds the bump associated with the face or loop specified by seed, and
highlights the face of the bump in red.
; find:bump ; create a bump (define blank (solid:block (position 0 0 0) (position 10 10 -1))) ;; blank (define tool (solid:block (position 1 1 0) (position 2 2 1))) ;; tool (define unite (solid:unite blank tool)) ;; unite ; pick out one face on the bump (define bump_face (car (entity:faces blank))) ;; bump_face ; pass in an empty string and list so that ; we highlight the default faces and loops ; belonging to the bump, but return no list (find:bump bump_face "" (list ) #t) ;; () ; loop:(entity 14 1) ; face:(entity 3 1) ; face:(entity 7 1) ; face:(entity 4 1) ; face:(entity 5 1) ; face:(entity 6 1) |
[Top]
entity | entity |
Description
Finds the zero-based pattern index associated with the entity specified
by entity.
; find:pattern-index ; make a prism (define height 1) ;; height (define maj_rad 1) ;; maj_rad (define min_rad 0.5) ;; min_rad (define num-sides 3) ;; num-sides (define prism (solid:prism height maj_rad min_rad num-sides)) ;; prism ; position the prism (define origin (position 1 2 3)) ;; origin (define transform (entity:transform prism (transform:axes origin (gvector 1 0 0) (gvector 0 1 0)))) ;; transform ; make a pattern (define center origin) ;; center (define normal (gvector 0 0 1)) ;; normal (define num-radial 4) ;; num-radial (define num-angular 5) ;; num-angular (define spacing 3) ;; spacing (define pat (pattern:radial center normal num-radial num-angular spacing)) ;; pat ; apply the pattern to the prism (define body (entity:pattern prism pat)) ;; body ; find the pattern index of a specific lump (define lump (list-ref (entity:lumps body) 8)) ;; lump (define index (find:pattern-index lump)) ;; index ; check the index (law:equal-test index 8) ;; #t |
[Top]
output-graph | graph |
vertex1 | string | entity |
vertex2 | string | entity |
Description
This extension adds an edge to an existing graph between two existing
vertices.
; graph:add-edge ; Create a simple example (define g1 (graph "me-you us-them")) ;; g1 ; Add a new edge between two existing vertices (define g2 (graph:add-edge g1 "me" "them")) ;; g2 |
[Top]
in-graph | graph |
in-name | string |
Description
This adds the in-name string as a vertex in in-graph.
; graph:add-vertex ; Create a simple example (define g1 (graph "me-you us-them")) ;; g1 ; Add a vertex. (define g2 (graph:add-vertex g1 "NEW_ONE")) ;; g2 ; CAREFUL: The order of the graph output may ; not be the same each time. ; Create an example using entities. (define b1 (solid:block (position -5 -10 -20) (position 5 10 15))) ;; b1 (define faces1 (entity:faces b1)) ;; faces1 ; Turn the block faces into vertices of the graph. (define g3 (graph faces1)) ;; g3 ; Add a vertex. (define g4 (graph:add-vertex g3 "NEW_ONE")) ;; g4 |
[Top]
in-graph | graph |
vertex1 | string | entity |
vertex2 | string | entity |
; graph:adjacent ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:adjacent g1 "we" "FIDO") ;; #f (graph:adjacent g1 "we" "they") ;; #t |
[Top]
in-graph | graph |
in-trunk | graph |
which-branch | integer |
keep-trunk | boolean |
Description
This command returns a subgraph of the given in-graph that is made up
of all the branches that are connected to a given vertex in the ordered
in-trunk graph.
; graph:branch ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (define g2 (graph "b-c")) ;; g2 (graph:order-from g2 "b") ;; 1 (graph:branch g1 g2 0) ;; #[graph "a"] (graph:branch g1 g2 0 #t) ;; #[graph "a-b"] (graph:branch g1 g2 1) ;; #[graph "f-g f-h d e"] (graph:branch g1 g2 1 #t) ;; #[graph "c-d c-e c-f f-g f-h"] |
[Top]
in-graph | graph |
in-which | integer | string | entity |
Description
This extension is useful if the given in-graph has multiple components.
It creates a new graph from just the elements of a single component.
; graph:component ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:components g1) ;; 3 (define g2 (graph:component g1 "me")) ;; g2 (define g3 (graph:component g1 "FIDO")) ;; g3 (define g4 (graph:component g1 1)) ;; g4 |
[Top]
in-graph | graph |
; graph:components ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:components g1) ;; 3 (define g2 (graph:component g1 "me")) ;; g2 (define g3 (graph:component g1 "FIDO")) ;; g3 (define g4 (graph:component g1 1)) ;; g4 |
[Top]
in-graph | graph |
; graph:connected? ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:connected? g1) ;; #f (graph:components g1) ;; 3 (define g2 (graph:component g1 "me")) ;; g2 (define g3 (graph:component g1 "FIDO")) ;; g3 (define g4 (graph:component g1 1)) ;; g4 (graph:connected? g4) ;; #t |
[Top]
in-graph | graph |
; graph:copy ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:component g1 "FIDO")) ;; g2 (define g3 (graph:copy g2)) ;; g3 ; CAREFUL: The order may not be the same as the ; original, but graphs are still equivalent. |
[Top]
in-graph | graph |
in-edge | string |
Description
A cutting edge is an edge whose removal creates more components in the
graph than are present when the edge is not removed.
; graph:cut-edge? ; Create a simple example (define g1 (graph "me-you us-them we-they them-they we-me us-me")) ;; g1 ; them-us they-we"] ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:cut-edges g1)) ;; g2 (graph:cut-edge? g1 "us-them") ;; #f (graph:cut-edge? g1 "me-you") ;; #t |
[Top]
in-graph | graph |
Description
A cutting edge is an edge whose removal creates more components in the
graph than are present when the edge is not removed.
; graph:cut-edges ; Create a simple example (define g1 (graph "me-you us-them we-they them-they we-me us-me")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:cut-edges g1)) ;; g2 (graph:cut-edge? g1 "us-them") ;; #f (graph:cut-edge? g1 "me-you") ;; #t |
[Top]
in-graph | graph |
test-vertex | string | entity |
Description
A cutting vertex is vertex whose removal creates more components in
the graph than are present when the vertex is not removed.
; graph:cut-vertex? ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:cut-vertices g1)) ;; g2 (graph:cut-vertex? g1 "us") ;; #f (graph:cut-vertex? g1 "SPOT") ;; #t |
[Top]
in-graph | graph |
Description
A cutting vertex is vertex whose removal creates more components in
the graph than are present when the vertex is not removed.
; graph:cut-vertices ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:cut-vertices g1)) ;; g2 |
[Top]
in-graph | graph |
in-vertex | string | entity |
Description
A cycle is defined as a connected group of vertices whose individual
removal from the graph results in a linear graph and the same number of
components. In other words, none of the vertices of the cycle are cut
vertices and none have edges to more than one vertex.
; graph:cycle-vertex? ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:cycle? g1) ;; #f (define g2 (graph:component g1 "FIDO")) ;; g2 (graph:cycle? g2) ;; #f (define g3 (graph:component g1 "me")) ;; g3 (graph:cycle? g3) ;; #t (graph:cycle-vertex? g1 "FIDO") ;; #f (graph:cycle-vertex? g1 "me") ;; #t (graph:cycle-vertex? g3 "me") ;; #t |
[Top]
in-graph | graph |
Description
A cycle is defined as a connected group of vertices whose individual
removal from the graph results in a linear graph and the same number of
components. In other words, none of the vertices of the cycle are cut
vertices and none have edges to more than one vertex.
; graph:cycle? ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:cycle? g1) ;; #f (define g2 (graph:component g1 "FIDO")) ;; g2 (graph:cycle? g2) ;; #f (define g3 (graph:component g1 "me")) ;; g3 (graph:cycle? g3) ;; #t |
[Top]
in-graph | graph |
in-vertex | string | entity |
; graph:degree? ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:degree? g1 "me") ;; 2 (graph:degree? g1 "SPOT") ;; 3 (graph:degree? g1 "PETEY") ;; 1 ; Create an example using entities. (define b1 (solid:block (position -5 -10 -20) (position 5 10 15))) ;; b1 (define faces1 (entity:faces b1)) ;; faces1 ; Turn the block faces into vertices of the graph. (define g3 (graph faces1)) ;; g3 (graph:degree? g3 "(Face 0)") ;; 4 (graph:degree? g3 (list-ref faces1 3)) ;; 4 |
[Top]
in-graph | graph |
Description
The edges of a graph can have entities associated with them. An example
of this is the case of a wirebody. In a wirebody, the vertices of the
wireframe become vertices in the graph while the edges of the wirebody
become edges in the graph.
; graph:edge-entities ; Create an example using entities. (define e1 (edge:linear (position 10 10 0) (position 10 -10 0))) ;; e1 (define e2 (edge:linear (position 10 -10 0) (position -10 -10 0))) ;; e2 (define e3 (edge:linear (position -10 -10 0) (position -10 10 0))) ;; e3 (define e4 (edge:linear (position -10 10 0) (position 10 10 0))) ;; e4 (define g1 (graph (list e1 e2 e3 e4))) ;; g1 (graph:edge-entities g1) ;; (#[entity 5 1] #[entity 4 1] #[entity 3 1] ;; #[entity 2 1]) (graph:vertex-entities g1) ;; (#[entity 6 1] #[entity 7 1] #[entity 8 1] ;; #[entity 9 1] #[entity 10 1] #[entity 11 1] ;; #[entity 12 1] #[entity 13 1]) (define b1 (solid:block (position -5 -10 -20) (position 5 10 15))) ;; b1 (define faces1 (entity:faces b1)) ;; faces1 ; Turn the block faces into vertices of the graph. (define g2 (graph faces1)) ;; g2 ; (entity 16 65536)-(entity 19 65536) (graph:edge-entities g2) ;; () (graph:vertex-entities g2) ;; (#[entity 20 1] #[entity 19 1] #[entity 18 1] ;; #[entity 17 1] #[entity 16 1] #[entity 15 1]) (define g3 (graph:unite g1 g2)) ;; g3 (graph:edge-entities g3) ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1] ;; #[entity 5 1]) (graph:vertex-entities g3) ;; (#[entity 13 1] #[entity 12 1] #[entity 11 1] ;; #[entity 10 1] #[entity 9 1] #[entity 8 1] ;; #[entity 7 1] #[entity 6 1] #[entity 15 1] ;; #[entity 16 1] #[entity 17 1] #[entity 18 1] ;; #[entity 19 1] #[entity 20 1]) |
[Top]
in-graph | graph |
edge-name | string |
weight | real |
vertex-name1 | string |
vertex-name2 | string |
; graph:edge-weight ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:edge-weight g1 "a" "b" 3) ;; #[graph "a-b b-c c-d c-e c-f f-g f-h"] (graph:edge-weight g1 "c-e" 5) ;; #[graph "a-b b-c c-d c-e c-f f-g f-h"] (graph:total-weight g1) ;; 8 |
[Top]
in-graph | graph |
use-ordering | boolean |
; graph:entities ; Create an example using entities. (define e1 (edge:linear (position 10 10 0) (position 10 -10 0))) ;; e1 (define e2 (edge:linear (position 10 -10 0) (position -10 -10 0))) ;; e2 (define e3 (edge:linear (position -10 -10 0) (position -10 10 0))) ;; e3 (define e4 (edge:linear (position -10 10 0) (position 10 10 0))) ;; e4 (define g1 (graph (list e1 e2 e3 e4))) ;; g1 (graph:entities g1) ;; (#[entity 6 1] #[entity 7 1] #[entity 8 1] ;; #[entity 9 1] #[entity 10 1] #[entity 11 1] ;; #[entity 12 1] #[entity 13 1] ;; #[entity 5 1] #[entity 4 1] #[entity 3 1] ;; #[entity 2 1]) (graph:edge-entities g1) ;; (#[entity 5 1] #[entity 4 1] #[entity 3 1] ;; #[entity 2 1]) (graph:vertex-entities g1) ;; (#[entity 6 1] #[entity 7 1] #[entity 8 1] ;; #[entity 9 1] #[entity 10 1] #[entity 11 1] ;; #[entity 12 1] #[entity 13 1]) (define b1 (solid:block (position -5 -10 -20) (position 5 10 15))) ;; b1 (define faces1 (entity:faces b1)) ;; faces1 ; Turn the block faces into vertices of the graph. (define g2 (graph faces1)) ;; g2 (graph:entities g2) ;; (#[entity 20 1] #[entity 19 1] #[entity 18 1] ;; #[entity 17 1] #[entity 16 1] #[entity 15 1]) (graph:edge-entities g2) ;; () (graph:vertex-entities g2) ;; (#[entity 20 1] #[entity 19 1] #[entity 18 1] ;; #[entity 17 1] #[entity 16 1] #[entity 15 1]) (define g3 (graph:unite g1 g2)) ;; g3 (graph:entities g3) ;; (#[entity 13 1] #[entity 12 1] #[entity 11 1] ;; #[entity 10 1] #[entity 9 1] #[entity 8 1] ;; #[entity 7 1] #[entity 6 1] #[entity 15 1] ;; #[entity 16 1] #[entity 17 1] #[entity 18 1] ;; #[entity 19 1] #[entity 20 1] #[entity 2 1] ;; #[entity 3 1] #[entity 4 1] #[entity 5 1]) (graph:edge-entities g3) ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1] ;; #[entity 5 1]) (graph:vertex-entities g3) ;; (#[entity 13 1] #[entity 12 1] #[entity 11 1] ;; #[entity 10 1] #[entity 9 1] #[entity 8 1] ;; #[entity 7 1] #[entity 6 1] #[entity 15 1] ;; #[entity 16 1] #[entity 17 1] #[entity 18 1] ;; #[entity 19 1] #[entity 20 1]) |
[Top]
in-graph | graph |
in-vertex | string | entity |
; graph:get-order ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:order-from g1 "a") ;; 4 (graph:get-order g1 "a") ;; 0 (graph:get-order g1 "b") ;; 1 (graph:get-order g1 "h") ;; 4 (graph:show-order g1) ;; ("a 0" "b 1" "c 2" "e 3" "d 3" "f 3" "g 4" "h 4") |
[Top]
in-graph1 | graph |
in-graph2 | graph |
Description
Given two graphs, returns a new graph that is a Boolean intersection
of the two.
; graph:intersect ; Create some simple graphs. (define g1 (graph "I-me me-myself myself-mine I-we we-us us-them")) ;; g1 (define g2 (graph "he-she it-thing they-those us-we them-us")) ;; g2 (define g3 (graph:intersect g1 g2)) ;; g3 |
[Top]
small-graph | graph |
large-graph | graph |
; graph:is-subset ; Create a graph (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (define g2 (graph "b-c c-e")) ;; g2 (define g3 (graph "h-i i-j")) ;; g3 (graph:is-subset g2 g1) ;; #t (graph:is-subset g3 g1) ;; #f |
[Top]
in-graph | graph |
kind | integer |
on-off | boolean |
Description
A graph can have multiple kinds assigned to it. Each kind can have a
status of #t or #f.
; graph:kind ; Create some simple graphs. (define g (graph "a-b b-c c-d c-e")) ;; g (graph:set-kind g 3 #t "a-b") ;; #[graph "a-b b-c c-d c-e"] (graph:set-kind g 3 #t "b-c") ;; #[graph "a-b b-c c-d c-e"] (graph:kind g 0 #f) ;; #[graph "a-b b-c c-d c-e"] (graph:kind g 3 #f) ;; #[graph "c-d c-e a b"] (graph:kind g 3 #t) ; *** Error graph:kind: A bad edge was added ; to a graph ;; #f (graph:kind? g 3 "a-b") ;; #t (graph:kind? g 2 "a-b") ;; #f (graph:kind? g 3 "b-c") ;; #t (graph:kind? g 3 "c-e") ;; #f ; Create a selective boolean example. (define blank (solid:block (position 0 0 0) (position 25 10 10))) ;; blank (define b2 (solid:block (position 5 0 0) (position 10 5 10))) ;; b2 (define b3 (solid:block (position 15 0 0) (position 20 5 10))) ;; b3 (define subtract1 (solid:subtract blank b2)) ;; subtract1 (define subtract2 (solid:subtract blank b3)) ;; subtract2 (define tool (solid:cylinder (position -5 2.5 5) (position 30 2.5 5)1)) ;; tool (define g (bool:select1 blank tool)) ;; g (define p (graph:kind g 0 #t)) ;; p (entity:set-color (graph:entities p) 6) ;; () |
[Top]
in-graph | graph |
kind | integer |
item1 | string | entity |
item2 | entity |
Description
A graph can have any number of kind types assigned to edges of the graph.
kind is a integer for the type and can take a Boolean value. If not specified,
it is assumed to be #f. The assignment of kind and its value is done on
a per edge basis.
; graph:kind? ; Create some simple graphs. (define g (graph "a-b b-c c-d c-e")) ;; g (graph:set-kind g 3 #t "a-b") ;; #[graph "a-b b-c c-d c-e"] (graph:set-kind g 3 #t "b-c") ;; #[graph "a-b b-c c-d c-e"] (graph:kind? g 3 "a-b") ;; #t (graph:kind? g 2 "a-b") ;; #f (graph:kind? g 3 "b-c") ;; #t (graph:kind? g 3 "c-e") ;; #f ; Create an example using entities. (define e1 (edge:linear (position 10 10 0) (position 10 -10 0))) ;; e1 (define e2 (edge:linear (position 10 -10 0) (position -10 -10 0))) ;; e2 (define e3 (edge:linear (position -10 -10 0) (position -10 10 0))) ;; e3 (define e4 (edge:linear (position -10 10 0) (position 10 10 0))) ;; e4 (define g1 (graph (list e1 e2 e3 e4))) ;; g1 (define ve (graph:vertex-entities g1)) ;; ve (graph:set-kind g1 0 #t (list-ref ve 0) (list-ref ve 1)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:set-kind g1 1 #t (list-ref ve 2) (list-ref ve 3)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:set-kind g1 2 #t (list-ref ve 4) (list-ref ve 5)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:kind? g1 0 (list-ref ve 0) (list-ref ve 1)) ;; #t (graph:kind? g1 1 (list-ref ve 0) (list-ref ve 1)) ;; #f (graph:kind? g1 2 (list-ref ve 0) (list-ref ve 1)) ;; #f (graph:kind? g1 0 (list-ref ve 2) (list-ref ve 3)) ;; #f (graph:kind? g1 1 (list-ref ve 2) (list-ref ve 3)) ;; #t (graph:kind? g1 2 (list-ref ve 2) (list-ref ve 3)) ;; #f (graph:kind? g1 0 (list-ref ve 4) (list-ref ve 5)) ;; #f (graph:kind? g1 1 (list-ref ve 4) (list-ref ve 5)) ;; #f (graph:kind? g1 2 (list-ref ve 4) (list-ref ve 5)) ;; #t |
[Top]
in-graph | graph |
item1 | string | entity |
item2 | entity |
Description
Given a graph and a vertex or edge, returns a list containing all kinds
on that vertex or edge. A graph can have any number of kind types assigned
to edges of the graph. kind is an integer for the type and can take a
Boolean value. If not specified, it is assumed to be #f. The assignment
of kind and its value is done on a per edge basis.
; graph:kinds? ; Create some simple graphs. (define g (graph "a-b b-c c-d c-e")) ;; g (graph:set-kind g 3 #t "a-b") ;; #[graph "a-b b-c c-d c-e"] (graph:set-kind g 3 #t "b-c") ;; #[graph "a-b b-c c-d c-e"] (graph:kinds? g "a-b") ;; (#f #f #f #t) (graph:kinds? g "b-c") ;; (#f #f #f #t) (graph:kinds? g "c-d") ;; () |
[Top]
in-graph | graph |
in-vertex1 | string | entity |
in-vertex2 | string | entity |
Description
After all edges have a weight assigned, this Scheme extension returns
a graph representing the path with the lightest total weight from one
given vertex to another.
; graph:lightest-path ; Create a simple graph. (define g1 (graph "a-b1 a-b2 b1-c b2-c c-d")) ;; g1 (graph:edge-weight g1 "a" "b1" 3) ;; #[graph "a-b1 a-b2 b1-c b2-c c-d"] (graph:edge-weight g1 "a-b2" 5) ;; #[graph "a-b1 a-b2 b1-c b2-c c-d"] (graph:edge-weight g1 "b1-c" 1) ;; #[graph "a-b1 a-b2 b1-c b2-c c-d"] (graph:edge-weight g1 "b2-c" 1) ;; #[graph "a-b1 a-b2 b1-c b2-c c-d"] (graph:edge-weight g1 "c-d" 1) ;; #[graph "a-b1 a-b2 b1-c b2-c c-d"] (graph:lightest-path g1 "a" "d") ;; #[graph "a-b1 b1-c c-d"] |
[Top]
in-graph | graph |
Description
This extension returns #t if the graph is linear.
; graph:linear? ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:linear? g1) ;; #f (define g2 (graph "me-you you-us us-them them-they")) ;; g2 (graph:linear? g2) ;; #t |
[Top]
in-graph | graph |
Description
For noncyclic ordered graphs, the highest numbered vertices are assigned
0 and new numbering for the vertices commences from there. For cyclic
ordered graphs, the 0 vertex remains the same, but sequence or direction
around the cycle changes.
; graph:negate ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:order-from g1 "a") ;; 4 (graph:show-order g1) ;; ("a 0" "b 1" "c 2" "e 3" "d 3" "f 3" "g 4" "h 4") (define g2 (graph:negate g1)) ;; g2 (graph:show-order g2) ;; ("a 4" "b 3" "c 2" "e 1" "d 1" "f 1" "g 0" "h 0") ; Create a simple cyclic example (define g3 (graph "me-you you-us us-them them-they me-they")) ;; g3 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:cycle? g3) ;; #t (graph:order-cyclic g3 "me" "you") ;; 4 (graph:show-order g3) ;; ("me 0" "you 4" "us 3" "them 2" "they 1") (define g4 (graph:negate g3)) ;; g4 (graph:show-order g4) ;; ("me 0" "you 1" "us 2" "them 3" "they 4") |
[Top]
in-graph | graph |
in-first | string | entity |
in-last | string | entity |
Description
A cycle is defined as a connected group of vertices whose individual
removal from the graph results in a linear graph and the same number of
components. In other words, none of the vertices of the cycle are cut
vertices and none have edges to more than one vertex. The extension returns
the number of vertices in the graph.
; graph:order-cyclic ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:component g1 "me")) ;; g2 (graph:cycle? g2) ;; #t (graph:order-cyclic g2 "me" "them") ;; 4 (graph:show-order g2) ;; ("they 4" "them 3" "us 2" "you 1" "me 0") |
[Top]
in-graph | graph |
in-vertex | string | entity |
Description
When ordering the graph starting at 0 for the specified in-vertex, each
subsequent vertex receives a number based on how far away it is (for example,
how many edges) from the starting vertex. The integer returned is the
maximum number of "hops" that one or more vertices are from the starting
vertex.
; graph:order-from ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:order-from g1 "a") ;; 4 (graph:show-order g1) ;; ("a 0" "b 1" "c 2" "e 3" "d 3" "f 3" "g 4" "h 4") |
[Top]
in-graph1 | graph |
in-graph2 | graph |
Description
This extension orders the in-graph1 with respect to in-graph2. The integer
returned is the maximum order number.
; graph:order-with ; Create a simple example (define g1 (graph "a-b b-c c-d d-e")) ;; g1 (graph:order-from g1 "a") ;; 4 (graph:show-order g1) ;; ("a 0" "b 1" "c 2" "d 3" "e 4") (graph:negate g1) ;; #[graph "a-b b-c c-d d-e"] (graph:show-order g1) ;; ("a 4" "b 3" "c 2" "d 1" "e 0") (define s1 (graph "a c e")) ;; s1 (graph:order-with s1 g1) ;; 2 (graph:show-order s1) ;; ("a 2" "c 1" "e 0") |
[Top]
in-graph | graph |
kind | integer |
on-off | boolean |
item1 | string | entity |
item2 | entity |
Description
A graph can have any number of kind types assigned to edges of the graph.
kind is a integer for the type and can take a Boolean on-off value. If
not specified, it is assumed to be #f. The assignment of kind and its
on-off value is done on a per edge basis.
; graph:set-kind ; Create a simple graph. (define g (graph "a-b b-c c-d c-e")) ;; g (graph:set-kind g 3 #t "a-b") ;; #[graph "a-b b-c c-d c-e"] (graph:set-kind g 3 #t "b-c") ;; #[graph "a-b b-c c-d c-e"] (graph:kind? g 3 "a-b") ;; #t (graph:kind? g 2 "a-b") ;; #f (graph:kind? g 3 "b-c") ;; #t (graph:kind? g 3 "c-e") ;; #f ; Create an example using entities. (define e1 (edge:linear (position 10 10 0) (position 10 -10 0))) ;; e1 (define e2 (edge:linear (position 10 -10 0) (position -10 -10 0))) ;; e2 (define e3 (edge:linear (position -10 -10 0) (position -10 10 0))) ;; e3 (define e4 (edge:linear (position -10 10 0) (position 10 10 0))) ;; e4 (define g1 (graph (list e1 e2 e3 e4))) ;; g1 (define ve (graph:vertex-entities g1)) ;; ve (graph:set-kind g1 0 #t (list-ref ve 0) (list-ref ve 1)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:set-kind g1 1 #t (list-ref ve 2) (list-ref ve 3)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:set-kind g1 2 #t (list-ref ve 4) (list-ref ve 5)) ;; #[graph "(entity 10 65536)-(entity 11 65536) ;; (entity 12 65536)-(entity 13 65536) ;; (entity 6 65536)-(entity 7 65536) ;; (entity 8 65536)-(entity 9 65536)"] (graph:kind? g1 0 (list-ref ve 0) (list-ref ve 1)) ;; #t (graph:kind? g1 1 (list-ref ve 0) (list-ref ve 1)) ;; #f (graph:kind? g1 2 (list-ref ve 0) (list-ref ve 1)) ;; #f (graph:kind? g1 0 (list-ref ve 2) (list-ref ve 3)) ;; #f (graph:kind? g1 1 (list-ref ve 2) (list-ref ve 3)) ;; #t (graph:kind? g1 2 (list-ref ve 2) (list-ref ve 3)) ;; #f (graph:kind? g1 0 (list-ref ve 4) (list-ref ve 5)) ;; #f (graph:kind? g1 1 (list-ref ve 4) (list-ref ve 5)) ;; #f (graph:kind? g1 2 (list-ref ve 4) (list-ref ve 5)) ;; #t |
[Top]
in-graph | graph |
in-vertex | string | entity |
Description
This extension can be used to trim away branches off of a cyclic graph.
; graph:shortest-cycle ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:shortest-cycle g1 "me")) ;; g2 (define g3 (graph:shortest-cycle g1 "FIDO")) ;; g3 |
[Top]
in-graph | graph |
in-vertex1 | string | entity |
in-vertex2 | string | entity |
Description
This extension can be used to trim away branches off of a cyclic graph.
; graph:shortest-path ; Create a simple example (define g1 (graph "me-you you-us us-them them-they me-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (define g2 (graph:shortest-path g1 "me" "us")) ;; g2 (define g3 (graph:shortest-path g1 "me" "FIDO")) ;; g3 (define g4 (graph:shortest-path g1 "PETEY" "FIDO")) ;; g4 |
[Top]
in-graph | graph |
; graph:show-order ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:order-from g1 "a") ;; 4 (graph:show-order g1) ;; ("a 0" "b 1" "c 2" "e 3" "d 3" "f 3" "g 4" "h 4") |
[Top]
in-graph | graph |
Description
This command breaks the branches of a graph into components. It splits
the graph into set of subgraphs that are either linear or cyclic with
no branches. No edge will belong to more than one subgraph. The union
of the subgraphs is the original graph.
; graph:split-branches; ; Create a simple example (define block1 (solid:block (position -10 -5 0) (position 5 10 15))) ;; block1 (define e (entity:edges block1)) ;; e (define v (entity:vertices block1)) ;; v (define g (graph e)) ;; g (define b-list (graph:split-branches g)) ;; b-list (define g0 (list-ref b-list 0)) ;; g0 (define g1 (list-ref b-list 1)) ;; g1 (define g2 (list-ref b-list 2)) ;; g2 (define g3 (list-ref b-list 3)) ;; g3 (define g4 (list-ref b-list 4)) ;; g4 (define g5 (list-ref b-list 5)) ;; g5 |
[Top]
in-graph | graph |
subset-law | law |
low-bounds | integer |
up-bounds | integer |
Description
Given an ordered graph, a subgraph may be formed using one of two techniques.
One method takes in two integers and the other takes a law pointer.
; graph:subset ; Create a simple graph (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:order-from g1 "a") ;; 4 (define g2 (graph:subset g1 1 3)) ;; g2 (define g3 (graph:subset g1 "x>2")) ;; g3 (define law1 (law "(x>2)or(x=0)")) ;; law1 (define g4 (graph:subset g1 law1)) ;; g4 |
[Top]
in-graph1 | graph |
in-graph2 | graph |
in-keep | boolean |
; graph:subtract ; Create some simple graphs. (define g1 (graph "I-me me-myself myself-mine I-we we-us us-them")) ;; g1 (define g2 (graph "he-she it-thing they-those us-we them-us")) ;; g2 (define g3 (graph:subtract g1 g2 #f)) ;; g3 (define g4 (graph:subtract g2 g1 #f)) ;; g4 (define g5 (graph:subtract g2 g1 #t)) ;; g5 |
[Top]
in-graph1 | graph |
in-graph2 | graph |
; graph:subtract-edges ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (define g2 (graph "c-f f-g f-h")) ;; g2 (define g3 (graph:subtract-edges g1 g2)) ;; g3 |
[Top]
in-graph | graph |
Description
If weights are assigned to individual edges of a graph, this returns
the total weight for all of the edges.
; graph:total-weight ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:edge-weight g1 "a" "b" 3) ;; #[graph "a-b b-c c-d c-e c-f f-g f-h"] (graph:edge-weight g1 "c-e" 5) ;; #[graph "a-b b-c c-d c-e c-f f-g f-h"] (graph:total-weight g1) ;; 8 |
[Top]
in-graph | graph |
; graph:tree? ; Create a simple graph. (define g1 (graph "a-b b-c c-e c-d c-f f-g f-h")) ;; g1 (graph:tree? g1) ;; #t (graph:linear? g1) ;; #f (graph:cycle? g1) ;; #f |
[Top]
in-graph1 | graph |
in-graph2 | graph |
Description
Given two graphs, this extension returns a new graph that is a Boolean
union of the two.
; graph:unite ; Create some simple graphs. (define g1 (graph "I-me me-myself myself-mine I-we we-us us-them")) ;; g1 (define g2 (graph "he-she it-thing they-those us-we them-us")) ;; g2 (define g3 (graph:unite g1 g2)) ;; g3 |
[Top]
in-graph | graph |
use-ordering | boolean |
Description
A graph can be created using faces, cells, or wires, which become vertices
of the graph.
; graph:vertex-entities ; Create an example using entities. (define e1 (edge:linear (position 10 10 0) (position 10 -10 0))) ;; e1 (define e2 (edge:linear (position 10 -10 0) (position -10 -10 0))) ;; e2 (define e3 (edge:linear (position -10 -10 0) (position -10 10 0))) ;; e3 (define e4 (edge:linear (position -10 10 0) (position 10 10 0))) ;; e4 (define g1 (graph (list e1 e2 e3 e4))) ;; g1 (graph:edge-entities g1) ;; (#[entity 5 1] #[entity 4 1] #[entity 3 1] ;; #[entity 2 1]) (graph:vertex-entities g1) ;; (#[entity 6 1] #[entity 7 1] #[entity 8 1] ;; #[entity 9 1] #[entity 10 1] #[entity 11 1] ;; #[entity 12 1] #[entity 13 1]) (define b1 (solid:block (position -5 -10 -20) (position 5 10 15))) ;; b1 (define faces1 (entity:faces b1)) ;; faces1 ; Turn the block faces into vertices of the graph. (define g2 (graph faces1)) ;; g2 (graph:edge-entities g2) ;; () (graph:vertex-entities g2) ;; (#[entity 20 1] #[entity 19 1] #[entity 18 1] ;; #[entity 17 1] #[entity 16 1] #[entity 15 1]) (define g3 (graph:unite g1 g2)) ;; g3 (graph:edge-entities g3) ;; (#[entity 2 1] #[entity 3 1] #[entity 4 1] ;; #[entity 5 1]) (graph:vertex-entities g3) ;; (#[entity 13 1] #[entity 12 1] #[entity 11 1] ;; #[entity 10 1] #[entity 9 1] #[entity 8 1] ;; #[entity 7 1] #[entity 6 1] #[entity 15 1] ;; #[entity 16 1] #[entity 17 1] #[entity 18 1] ;; #[entity 19 1] #[entity 20 1]) |
[Top]
in-graph | graph |
in-object | string | entity |
Description
This extension is useful if the given in-graph has multiple components.
It determines which component a given in-object is part of and returns
its component number. The graph:component
command then creates a new graph from just the elements of a single component.
; graph:which-component ; Create a simple example (define g1 (graph "me-you us-them we-they them-they FIDO-SPOT SPOT-KING SPOT-PETEY")) ;; g1 ; CAREFUL: The order of the graph output may ; not be the same each time. (graph:components g1) ;; 3 (graph:which-component g1 "me") ;; 2 (define g2 (graph:component g1 2)) ;; g2 (define g3 (graph:component g1 "me")) ;; g3 |
[Top]
x | real |
y | real |
z | real |
space | string |
; gvector ; Create gvectors of various types. (gvector 3 3 3) ;; #[gvector 3 3 3] (gvector 5 5 5 "wcs") ;; #[gvector 5 5 5] (gvector 5 5 5 "model") ;; #[gvector 5 5 5] (gvector 5 5 5 "polar") ;; #[gvector 4.98097349045873 0.435778713738291 5] (gvector 5 5 5 "cylindrical") ;; #[gvector 4.98097349045873 0.435778713738291 5] (gvector 5 5 5 "spherical") ;; #[gvector 0.434120444167326 0.0379806174694798 ;; 4.98097349045873] |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
This extension returns the result of (gvector1 + gvector2) as a gvector.
; gvector:+ ; Add two gvectors by components. (gvector:+ (gvector 1 3 2) (gvector 2 2 2)) ;; #[gvector 3 5 4] |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
This extension returns the result of (gvector1 - gvector2) as a gvector.
; gvector:- ; Subtract two gvectors by components. (gvector:- (gvector 1 3 2) (gvector 2 2 2)) ;; #[gvector -1 1 0] |
[Top]
gvector | gvector |
; gvector:copy ; Create a gvector by copying an existing gvector. (define copy (gvector:copy (gvector 6 5 2))) ;; copy |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
If the i, j, k components of vector a are <a1,
a2, a3>, and the i, j, k components of vector
b are <b1, b2, b3>, the cross product
a x b is:
|a2 a3| |a1 a3|
|a1 a2|
a x b =| |i - |
|j + | |k
|b2 b3|
|b1 b3| |b1 b2|
a x b = [(a2)(b3)-(b2)(a3)]i
- [(a1)(b3)-(b1)(a3)]j
+ [(a1)(b2)-(b1)(a2)]k
The resulting cross product vector is perpendicular to both input vectors. The cross product a x b is not the same as the cross product b x a; they point in opposite directions (180 degrees from one another).
; gvector:cross ; Compute the cross product of two gvectors. (gvector:cross (gvector 2 2 2) (gvector 5 3 8)) ;; #[gvector 10 -6 -4] (gvector:cross (gvector 5 3 8) (gvector 2 2 2)) ;; #[gvector -10 6 4] |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
If the i, j, k components of vector a are <a1,
a2, a3>, and the i, j, k components of vector
b are <b1, b2, b3>, the dot product
a . b is:
gvector1 = (a1 a2 a3) = a
gvector2 = (b1 b2 b3) = b
a . b = (a1*b1 + a2*b2 + a3*b3)
a . b = |a||b|cosq
; where q is the angle
; between a and b
The result of a dot product is a scalar value.
; gvector:dot ; Compute the dot product of two gvectors. (gvector:dot (gvector 3 5 1) (gvector 2 4 7)) ;; 33 |
[Top]
position1 | position |
position2 | position |
Description
This extension returns the gvector from position1 to position2.
; gvector:from-to ; Create a gvector from one position to another. (gvector:from-to (position 0 0 0) (position 5 1 6)) ;; #[gvector 5 1 6] |
[Top]
gvector | gvector |
Description
Returns the length of a gvector as a real value.
; gvector:length ; Determine the length of two gvectors. (gvector:length (gvector 0 6 0)) ;; 6 (gvector:length (gvector 4 4 4)) ;; 6.92820323027551 |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
This extension returns #t if gvector1 and gvector2 are parallel; otherwise,
it returns #f. A zero gvector is not parallel to anything, including itself,
so it causes the extension to return #t.
; gvector:parallel? ; Determine if two gvectors are parallel. (gvector:parallel? (gvector 3 5 0) (gvector 6 10 0)) ;; #t (gvector:parallel? (gvector 1 0 0) (gvector 0 1 0)) ;; #f |
[Top]
gvector1 | gvector |
gvector2 | gvector |
Description
This extension returns #t if the gvectors are perpendicular; otherwise,
it returns #f. A zero gvector is perpendicular to all gvectors, including
itself, and it causes the extension to return #f.
; gvector:perpendicular? ; Determine if two gvectors are perpendicular. (gvector:perpendicular? (gvector 3 5 0) (gvector 6 10 0)) ;; #f (gvector:perpendicular? (gvector 1 0 0) (gvector 0 1 0)) ;; #t |
[Top]
gvector | gvector |
; gvector:reverse ; Reverses the direction of a gvector. (gvector:reverse (gvector 0 1 0)) ;; #[gvector 0 -1 0] |
[Top]
gvector | gvector |
scale | real |
Description
The resulting gvector is the original gvector scaled by the number.
; gvector:scale ; Multiply two gvectors by a scaling factor. (gvector:scale (gvector 0 -1 0) 3) ;; #[gvector 0 -3 0] (gvector:scale (gvector 0 -1 0) -7) ;; #[gvector 0 7 0] |
[Top]
gvector | gvector |
x | real |
y | real |
z | real |
Description
The coordinates are computed relative to the active coordinate system.
; gvector:set! ; Set new x-, y-, and z-components ; in an existing gvector. (define vector1 (gvector 1 0 0)) ;; vector1 (gvector:set! vector1 0 7 3) ;; #[gvector 0 7 3] vector1 ;; #[gvector 0 7 3] (define outline (gvector 0 0 1)) ;; outline (gvector:set! outline 3 5 4) ;; #[gvector 3 5 4] |
[Top]
gvector | gvector |
x | real |
Description
The coordinates are computed relative to the active coordinate system.
This extension returns the x-value as a real.
; gvector:set-x! ; Set new x-, y-, and z-components ; in an existing gvector. (define vector1 (gvector 1 0 0)) ;; vector1 ; Set a new x-component in an existing gvector. (gvector:set-x! vector1 3) ;; 3 |
[Top]
gvector | gvector |
y | real |
Description
The coordinates are computed relative to the active coordinate system.
This extension returns the y-value as a real.
; gvector:set-y! ; Set new x-, y-, and z-components ; in an existing gvector. (define vector1 (gvector 1 0 0)) ;; vector1 ; Set a new y-component in an existing gvector. (gvector:set-y! vector1 6) ;; 6 |
[Top]
gvector | gvector |
z | real |
Description
The coordinates are computed relative to the active coordinate system.
This extension returns the z-value as a real.
; gvector:set-z! ; Set new x-, y-, and z-components ; in an existing gvector. (define vector1 (gvector 1 0 0)) ;; vector1 ; Set a new z-component in an existing gvector. (gvector:set-z! vector1 2) ;; 2 |
[Top]
gvector | gvector |
transform | transform |
; gvector:transform ; Create a gvector. (define vector1 (gvector 1 1 0)) ;; vector1 ; Apply a transform to a gvector. (gvector:transform vector1 (transform:reflection (position 0 0 0) (gvector 1 0 0))) ;; #[gvector -1 1 0] |
[Top]
gvector | gvector |
; gvector:unitize ; Create a gvector. (define vector1 (gvector 7 3 0 "model")) ;; vector1 ; Create a gvector as a unit vector. (gvector:unitize vector1) ;; #[gvector 0.919145030018058 0.393919298579168 0] |
[Top]
gvector | gvector |
Description
This extension returns the x-coordinate of the gvector, transformed
to the active WCS.
; gvector:x ; Create a gvector. (define vector1 (gvector 7 5 0 "spherical")) ;; vector1 ; Determine the x-component of a gvector. (gvector:x vector1) ;; 0.610090199233607 |
[Top]
gvector | gvector |
Description
This extension returns the y-coordinate of the gvector, transformed
to the active WCS.
; gvector:y ; Create a gvector. (define vector1 (gvector 7 5 0 "spherical")) ;; vector1 ; Determine the y-component of a gvector. (gvector:y vector1) ;; 0 |
[Top]
gvector | gvector |
Description
This extension returns the z-coordinate of the gvector, transformed
to the active WCS.
; gvector:z ; Create a gvector. (define vector1 (gvector 7 5 0 "spherical")) ;; vector1 ; Determine the z-component of a gvector. (gvector:z vector1) ;; 6.97336288664222 |
[Top]
object | scheme-object |
; gvector? ; Create a gvector. (define vector1 (gvector 7 5 0 "spherical")) ;; vector1 ; Determine if the following objects are gvectors. (gvector? vector1) ;; #t (gvector? (position 0 0 0)) ;; #f (gvector? -4) ;; #f |
[Top]
history | history |
Description
This routine examines the root delta state of the specified history
stream. If the root state is empty (no bulletin boards), then it does
nothing. If the root state is not empty, then it adds a new, empty, root
state immediately before the original root state. In either case,
it returns the ID number of the (empty) root state.
; history:ensure-empty-root-state ; No example available at this time |
[Top]
history | history |
Description
Returns an integer representing the active state's id in the active
history stream. An optional history stream may be specified, causing its
associated active state to be returned. If no stream is specified, the
default history stream is used.
; history:get-active-state-id ; Example not available for this release |
[Top]
none |
; history:get-default ; get the default history stream (history:get-default) ;; #[(deleted) history -1] |
[Top]
id | integer |
history | history |
Description
Returns an ENTITY
from a given tag id in the HISTORY_STREAM
specified. If no stream is specified, the default stream is used.
; history:get-entity-from-id ; Create a block (define b (solid:block (position -10 -10 -10) (position 10 10 10))) ;; b (define lop (lop:offset-body b 5)) ;; lop (define f (pick:face (ray (position 0 0 0) (gvector 1 0 0)))) ;; f (entity:set-color f BLUE) ;; () (define id (entity:get-id f)) ;; id (roll) ;; -1 (roll) ;; -1 (entity:set-color (history:get-entity-from-id id) RED) ;; () |
[Top]
history | history |
Description
This extension gets the
HISTORY_STREAM specific API logging behavior. The default stream
is used if no stream is specified. Distributed history must be enabled for
stream-specific logging to have any meaning.
; history:get-logging ; enable history distribution (part:set-distribution-mode 1) ;;#t ; create a new part (define p2 (part:new)) ;;p2 ; make it active (env:set-active-part p2) ;;() ; disable API logging on this history stream (history:set-logging "disable") ;;#t (history:get-logging) ;;"disabled" |
[Top]
setting | string |
history | history |
Description
This extension sets the
HISTORY_STREAM
specific API logging behavior. The default stream is used if no stream is specified.
Distributed history must be enabled for stream-specific logging to have any affect.
If the stream-specific logging flag is unset, then the global API logging flag is used.
See
api_logging and
api_get_stream_logging for more information.
; history:set-logging ; enable history distribution (part:set-distribution-mode 1) ;;#t ; create a new part (define p2 (part:new)) ;;p2 ; make it active (env:set-active-part p2) ;;() ; disable API logging on this history stream (history:set-logging "disable") ;;#t ; create a block (define b_of_2 (solid:block 0 0 0 10 10 10)) ;;b_of_2 ; create a sphere (define s_of_2 (solid:sphere 0 0 0 5)) ;;s_of_2 ; unite them (bool:unite b_of_2 s_of_2) ;;#[entity 1 2] ; we should not be able to roll back (law:equal-test 0 (roll -1) "should not be able to roll") ;;#t |
[Top]
None |
Description
Checks all history streams for mixing and bad entity ids. Returns #t
if all are OK, or #f otherwise (also reports error to debug_file_ptr).
; history:validate-streams ;; make a stream (define block (solid:block 0 0 0 10 10 10)) ;; block (roll) ;; -1 (define sphere (solid:sphere 0 0 0 10)) ;; sphere ; verify that it (and all other streams) are valid (history:validate-streams) ; 1 history streams checked. ;; #t |
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.