Frames
Frame is a system of coordinate axes.
It is uniquely determined by 3D point of its origin in global coordinates and 3D
vectors of its axes. To be valid, vectors of the axes must have length 1.0 and
be perpendicular to each other. Programmatically frames are manipulated by
IFrame_DG interface
Frame is a very important and frequently used concept. It
represents both location and orientation.
Nearly all items in 3D scene of DG Kernel have intrinsic frame member
(property) called local frame, which defines location and orientation of the
object (entity). Local frame of an entity is accessed via IEntity_DG.GetLocation(). Geometry of an entity is always defined relative to its local
axes to make it invariant under any movement.
To create a new (standalone) frame use: DGKernel > GetModel() > IModel_DG >
IObjectGenerator_DG >
Create("Frame_DG") >
IFrame_DG.
Frames and Transforms
There is a close correspondence between frames and transforms of 3D space. In
particular this correspondence allows performing multiplication operation on
frames similar to composition of transforms. See more details at
Transforms topic
Drawing a frame
Local frame of an entity is rendered if the visibility flag controlled by
IScene_DG.ShowLocalFrame() /
IScene_DG.IsLocalFrameVisible() is on.
A standalone frame can be added to the scene with the help of IScene_DG.
To draw a frame, use IScene_DG.CreatePresentationEntity(obj, true, options).
Where obj is an IObject_DG queried from the IFrame_DG. And the options is a
IDictionary_DG, which specifies size of the displayed frame.
To construct the options object, use:
DGKernel > GetModel() > IModel_DG >
IObjectGenerator_DG >
Create("Dictionary_DG") >
IDictionary_DG >
SetDouble("Size", theSize)
See UpdateFramePresentationEntity() method of
Collision Path
sample for an example.
|