Package Documentation

Object: BEZIER-CURVE (The :GEOM-BASE Package)
Mixins: BASE-OBJECT

Description

GDL currently supports third-degree Bezier curves, which are defined using four 3D control-points. The Bezier curve always passes through the first and last control points and lies within the convex hull of the control points. At the start point (i.e. the first control point), the curve is tangent to the vector pointing from the start point to the second control point. At the end point (i.e. the last control point), the curve is tangent to the vector pointing from the end point to the third control point.


Input Slots (required)

CONTROL-POINTS list of 4 3d points

Specifies the control points for the Bezier curve.



Input Slots (optional)

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 [from BASE-OBJECT] 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 [from BASE-OBJECT] 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 [from BASE-OBJECT] 3x3 orthonormal matrix of double-float numbers

This is synonymous with the orientation.


ONCLICK-FUNCTION [from BASE-OBJECT] 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 support this functionality, e.g. SVG/Raphael and X3DOM.


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 [from BASE-OBJECT] 3d point

Indicates in global coordinates where the center of the reference box of this object should be located.


DISPLAY-CONTROLS [from BASE-OBJECT] 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 [from BASE-OBJECT] number

Z-axis dimension of the reference box. Defaults to zero.


LENGTH [from BASE-OBJECT] number

Y-axis dimension of the reference box. Defaults to zero.


ORIENTATION [from BASE-OBJECT] 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 [from BASE-OBJECT] number

X-axis dimension of the reference box. Defaults to zero.



Computed Slots

BOUNDING-BOX [from BASE-OBJECT] 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.



GDL Functions

CIRCLE-INTERSECTION-2D list of 3d points

Returns points of intersection in the Z plane between this Bezier curve and the circle in the Z plane with center center and radius radius.

arguments:
center 3D Point
The center of the circle to be intersected
radius Number
The radius of the circle to be intersected
keyword arguments:
accuracy Number, Default Value: (* 10.0 DOUBLE-FLOAT-EPSILON)
Target accuracy
maximum-number-of-iterations Integer, Default Value: 30
Maximum iterations of polynomial solver

LINE-INTERSECTION-2D list of 3d points

Returns points of intersection in the Z plane between this Bezier curve and the infinite line containing point point and direction vector. Use the between? function if you wish to establish whether the point is contained in a particular line segment.

arguments:
point 3D Point
Any point in the line to be intersected
vector 3D Vector
The direction of the line to be intersected
keyword arguments:
accuracy Number, Default Value: (* 10.0 DOUBLE-FLOAT-EPSILON)
Target accuracy
maximum-number-of-iterations Integer, Default Value: 30
Maximum iterations of polynomial solver

POINT 3d point

Returns the point on this Bezier curve corresponding to the given parameter, which should be between 0 and 1.

arguments:
parameter Number
Curve parameter, between zero and one (0 and 1)

Examples

 (in-package :gdl-user)

 (define-object bezier-sample (bezier-curve)
  :computed-slots
  ((control-points (list (make-point 0 0 0)
                         (make-point 1 1 0)
                         (make-point 2 1 0)
                         (make-point 3 0 0))))
  :objects
  ((points-display :type 'points-display
                   :points (the control-points))))

 (generate-sample-drawing :objects (let ((self (make-object 'bezier-sample)))
                                     (list self (the points-display))))

Package Documentation