ITransform Interface
- TranslateLoc
- ScaleLoc
- RotateLoc
- Apply
- RotateLoc2
The interface allows changing size of objects or translating surface relative
to the local frame. Unlike object movement interfaces (I3DObject,
IFrame, IFrame2)
which move the object along with its local frame as a whole, ITransform modifies
parameters of surface of the object because relative position/orientation of the
local frame and surface of the object is modified.
ITransform can be queried from the relevant ISection
interface.
See also: Interface List
HRESULT TranslateLoc(double vx, double vy, double vz, VARIANT_BOOL includeChildren)
Parameters
vx,vy,vz - [in] Coordinates of the
translation vector in local frame of the object.
includeChildren - [in] if true the operation is
applied to all children of the object too.
-
- Remarks:
The methods modifies geometry of the object so that it appears translated
relative to the local system of coordinates. When includeChildren is
true all children of the object are translated by vx,vy,vz along
with its local frame. UpdateSurface
must be called after this method for the object to be rendered correctly
Note: sequence of calls IFrame2.Translate(vx, vy, vz)
ITransform.TranslateLoc(-vx, -vy, -vz) is equivalent to translation of local
frame relative to the object, or in other words repositioning of the local
frame.
For curved patches of 3DS objects scaling
may change slightly curvature of patches as exact transformation is not always geometrically
possible.
Translation of SOR objects translates the
surface along the axis in positive or negative direction of z-axis when vx and
vy are 0. When vx or vy are not 0 but
equal the generatrix is translated
in x and z plane along two-dimensional vector (vx,vz).
HRESULT ScaleLoc(double scalex, double scaley, double scalez, VARIANT_BOOL includeChildren)
Parameters
scalex, scaley, scalez - [in]
multipliers for scaling up or down respective dimension of the object in the local
axes. All multipliers must be strictly greater than 0. Dimension of the object
will be increased or decreased depending whether the respective multiplier is
greater or less than 1. Supplying 1 for a multiplier will leave the
dimension unchanged.
includeChildren - [in] if true the operation is
applied to all children of the object too.
Return Values
-
- DISP_E_PARAMNOTOPTIONAL if some of the multipliers are
near zero (less than 1e-3) or negative.
-
- Remarks:
The method modifies geometry of the object so that its size will be
multiplied as expressed relative to the local system of coordinates. When, for
example, all scalex, scaley, scalez are equal to 2.0 the
object will be twice as large, When multipliers are not the same the object will
appear stretched or contracted.
For SOR objects when vx and vy are not
equal the object is converted to Mesh
Entity type prior the scaling operation.
UpdateSurface
must be called after this method for the object to be rendered correctly.
To scale against a point other that origin of the local frame use TranslateLoc
method to translate the object prior the operation. Most often it is needed to
call TranslateLoc afterwards with the opposite
vector to translate the object back.
When includeChildren is true the operation is
applied to all children of the object with scales transformed appropriately to
the local frame of the child.
HRESULT RotateLoc(double degrees, DIVect* axis, VARIANT_BOOL
frameOrObject)
Parameters
degrees - [in]
Angle of rotation in degrees
axis - [in]
Axis of rotation in local frame of the object. For
3DS and entity types this parameter is
ignored and axis is assumed to be (1, 0, 0) vector.
frameOrObject- [in] if true the local frame is
rotated. Otherwise surface of the object is rotated, while the local frame
remains unchanged
Return Values
-
- ERROR_INVALID_STATE if the rotation can not be performed for the
type of the object.
-
- Remarks:
The method modifies relative orientation of local frame of the object and
surface of the object. This operation is considered as a geometry change, which
means that coordinates and parameters of elements of the surface, like vertex
coordinates, will be different.
Some object types, like SOR, can not be rotated.
Call to this method in this case returns the error code or throws an exception
in high level environments.
HRESULT Apply(IFrame* target, VARIANT_BOOL frameOrObject)
Parameters
target - [in]
IFrame, which defines the transformation. See
remarks.
frameOrObject- [in] if true the local frame is
made identical to target. Otherwise surface of the object is
transformed as described in the remarks, while the local frame
remains unchanged
-
- Remarks:
If frameOrObject is true the surface of the object
remains unchanged relative to the global frame, but local frame becomes identical to target.
If frameOrObject is false the method performs general
isometric linear transformation of surface of the object. The surface under
transformation is changed as if the object, which implements this ITransform,
was moved in space so that its local frame coincides with target.
The local frame remains the same in this case relatively to the global axes. In
other words a 3D point with global coordinates x, y , z is mapped under the
transformation to point with same coordinates in frame target.
Besides using IFrame of an existent object, target
can be created standalone as described
in IFrame topic. Use IFrame.SetAxes and
IFrame.SetOrigin to manipulate the
target.
HRESULT RotateLoc2(double degrees, DIPoint* originAxis, DIVect* directionAxis, VARIANT_BOOL frameOrObject, VARIANT_BOOL includeChildren)
-
- Remarks:
This method behaves similarily to RotateLoc() above, except when includeChildren is true
children of the object (or their local frames) are rotated around the same axis.
Both
originAxis and directionAxis must have coordinates relative to the local frame of the object this interface was queried from.
originAxis and directionAxis are converted internally to a global vector on the start of the operation
|