Package Documentation

Object: base-object (The :geom-base Package)
Mixins: vanilla-mixin

Description

Base-Object is a superclass of most of GDL's geometric primitives. It provides an imaginary geometric reference box with a length, width, height, center, and orientation.


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:

:color
color keyword from the *color-table* parameter, or an HTML-style hexidecimal RGB string value, e.g. "#FFFFFF" for pure white. Defaults to :black.
:line-thickness
an integer, defaulting to 1, indicating relative line thickness for wireframe representations of this object.
:dash-pattern
(currently PDF/PNG/JPEG only). This is a list of two or three numbers which indicate the length, in pixels, of the dashes and blank spaces in a dashed line. The optional third number indicates how far into the line or curve to start the dash pattern.


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.

note:
An orientation of NIL indicates the 3x3 identity matrix.


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.

arguments:
axis Keyword
One of the standard axis keywords: :lateral, :longitudinal, :vertical

edge-center 3d point

Returns the center of the requested edge of this object's reference box.

arguments:
direction-1 Keyword
One of the standard direction keywords: :right, :left, :rear, :front, :top, :bottom
direction-2 Keyword
A standard direction keyword orthogonal to direction-1

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.

arguments:
direction Keyword
One of the standard direction keywords: :right, :left, :rear, :front, :top, :bottom

face-normal-vector 3d vector

Returns the vector pointing from this object's reference box center to its requested face-center.

arguments:
direction Keyword
One of the standard direction keywords: :right, :left, :rear, :front, :top, :bottom

face-vertices list of four 3d points

Returns the vertices of the indicated face.

arguments:
direction Direction keyword, e
g. :top, :bottom etc. Indicates for which face to return the vertices

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.

arguments:
point 3D-point
The point to be converted to local coordinates
examples:
Please see the examples area.

in-face? boolean

Returns non-nil if the given point is in halfspace defined by the plane given a point and direction.

arguments:
point 3D point
a point in the plane
direction 3D vector
The normal of the plane

line-intersection-points list of 3d points

Returns the points of intersection between given line and the reference box of this object.

arguments:
p-line 3D point
A point in the line
u-line 3D vector
The direction vector of the line

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.

arguments:
point 3D-point
The local point to be converted to global coordinates
examples:
Please see the examples area.

vertex 3d point

Returns the center of the requested vertex (corner) of this object's reference box.

arguments:
direction-1 Keyword
One of the standard direction keywords: :right, :left, :rear, :front, :top, :bottom
direction-2 Keyword
A standard direction keyword orthogonal to direction-1
direction-3 Keyword
A standard direction keyword orthogonal to direction-1 and direction-2

Examples


 (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): 
|#
;;
;;
;;

Package Documentation