| Object: base-object (The :geom-base Package) |
| Mixins: vanilla-mixin |
| Input Slots (optional) | |
| bounding-box list of two 3d points | |
The left front bottom and right rear top corners, in global coordinates, of the rectangular volume bounding the tree of geometric objects rooted at this object. | |
| hidden? [from vanilla-mixin*] boolean | |
Indicates whether the object should effectively be a hidden-object even if specified in :objects. Default is nil. | |
| image-file pathname or string | |
Points to a pre-existing image file to be displayed instead of actual geometry for this object. Defaults to nil | |
| local-box list of two 3d points | |
The left front bottom and right rear top corners, in global coordinates, of the rectangular volume bounding this geometric object. | |
| obliqueness 3x3 orthonormal matrix of double-float numbers | |
This is synonymous with the orientation. | |
| onclick-function lambda function of zero arguments, or nil | |
If non-nil, this function gets invoked when the user clicks the object in graphics front-ends which may or may not support this functionality (see viewport-html-div). | |
| root [from vanilla-mixin*] gdl instance | |
The root-level node in this object's ``tree'' (instance hierarchy). | |
| safe-children [from vanilla-mixin*] list of gdl instances | |
All objects from the :objects specification, including elements of sequences as flat lists. Any children which throw errors come back as a plist with error information | |
| strings-for-display [from vanilla-mixin*] string or list of strings | |
Determines how the name of objects of this type will be printed in most places. This defaults to the name-for-display (generally the part's name as specified in its parent), followed by an index number if the part is an element of a sequence. | |
| visible-children [from vanilla-mixin*] list of gdl instances | |
Additional objects to display in Tatu tree. Typically this would be a subset of hidden-children. Defaults to NIL. | |
| Input Slots (optional, defaulting) | |
| center 3d point | |
Indicates in global coordinates where the center of the reference box of this object should be located. | |
| display-controls plist | |
May contain keywords and values indicating display characteristics for this object. The following keywords are recognized currently:
| |
| height number | |
Z-axis dimension of the reference box. Defaults to zero. | |
| length number | |
Y-axis dimension of the reference box. Defaults to zero. | |
| orientation 3x3 matrix of double-float numbers | |
Indicates the absolute Rotation Matrix used to create the coordinate system of this object. This matrix is given in absolute terms (i.e. with respect to the root's orientation), and is generally created with the alignment function. It should be an orthonormal matrix, meaning each row is a vector with a magnitude of one (1.0). | |
| width number | |
X-axis dimension of the reference box. Defaults to zero. | |
| Computed Slots | |
| color-decimal vector of three real numbers | |
The RBG color of this object specified in :display-controls. Defaults to the foreground color specified in *colors-default*. This message should not normally be overridden in user application code. | |
| local-center 3d point | |
The center of this object, from the perspective of the parent. Starting from the parent's center and using the parent's orientation, this is the relative center of this object. | |
| local-center* 3d point | |
The center of this object, from the perspective of the parent. Starting from the parent's center and using the parent's orientation, this is the relative center of this object. | |
| local-orientation 3x3 matrix of double-float numbers | |
Indicates the local Rotation Matrix used to create the coordinate system of this object. This is the ``local'' orientation with respect to the parent. Multiplying the parent's orientation with this matrix will always result in the absolute orientation for this part.
| |
| Hidden Objects | |
| bounding-bbox gdl object of type box | |
A box representing the bounding-box. | |
| local-bbox gdl object of type box | |
A box representing the local-box. | |
| GDL Functions | |
| axis-vector 3d vector | |
Returns the vector pointing in the positive direction of the specified axis of this object's reference box.
| |
| edge-center 3d point | |
Returns the center of the requested edge of this object's reference box.
| |
| face-center 3d point | |
Returns the center of the requested face (the requested face with respect to the `wrt` argument if present, or self if `wrt` is nil) of this object's reference box.
| |
| face-normal-vector 3d vector | |
Returns the vector pointing from this object's reference box center to its requested face-center.
| |
| face-vertices list of four 3d points | |
Returns the vertices of the indicated face.
| |
| global-to-local 3d-point | |
This function returns the point given in global coordinates, into relative local coordinates, based on the orientation and center of the object to which the global-to-local message is sent.
| |
| in-face? boolean | |
Returns non-nil if the given point is in halfspace defined by the plane given a point and direction.
| |
| line-intersection-points list of 3d points | |
Returns the points of intersection between given line and the reference box of this object.
| |
| local-to-global 3d-point | |
This function returns the point given in relative local coordinates, converted into global coordinates, based on the orientation and center of the object to which the local-to-global message is sent.
| |
| vertex 3d point | |
Returns the center of the requested vertex (corner) of this object's reference box.
| |
(in-package :gdl-user)
(define-object tower (base-object)
:input-slots
((number-of-blocks 50) (twist-per-block 1)
(block-height 1) (block-width 5) (block-length 7))
:objects
((blocks :type 'box
:sequence (:size (the number-of-blocks))
:center (translate (the center)
:up (* (the-child index)
(the-child height)))
:width (the block-width)
:height (the block-height)
:length (the block-length)
:orientation (alignment
:rear (if (the-child first?)
(rotate-vector-d (the (face-normal-vector :rear))
(the twist-per-block)
(the (face-normal-vector :top)))
(rotate-vector-d (the-child previous
(face-normal-vector :rear))
(the twist-per-block)
(the (face-normal-vector :top))))
:top (the (face-normal-vector :top))))))
;;
;;Test run
;;
#|
gdl-user(46): (setq self (make-object 'tower))
#tower @ #x750666f2
gdl-user(47): (setq test-center (the (blocks 10) center))
#(0.0 0.0 10.0)
gdl-user(48): (the (blocks 10) (global-to-local test-center))
#(0.0 0.0 0.0)
gdl-user(49): (the (blocks 10) (local-to-global (the (blocks 10)
(global-to-local test-center))))
#(0.0 0.0 10.0)
gdl-user(50):
gdl-user(50): (setq test-vertex (the (blocks 10) (vertex :top :right :rear)))
#(1.7862364748012536 3.9127176305081863 10.5)
gdl-user(51): (the (blocks 10) (global-to-local test-vertex))
#(2.500000000000001 3.500000000000001 0.5)
gdl-user(52): (the (blocks 10) (local-to-global (the (blocks 10)
(global-to-local test-vertex))))
#(1.786236474801254 3.9127176305081877 10.5)
gdl-user(53):
|#
;;
;;
;;