IFrame3 Interface
- GetOrigin
- SetOrigin
- GetAxis
- Translate
- TranslateGlobal
- Rotate
- RotateGlobal
- SetAxes
- SetupAxes
- Reset
- ResetOrientation
- Copy
- ToLocal
- ToGlobal
- Push
- Pop
- ToLocalVector
- ToGlobalVector
- ToLocalFrame
- ToGlobalFrame
- Invert
The interface gives access to frames.
This interface was added in version 2.3 to give convenient access via single
interface to all functionality provided by other
frames-related interfaces, namely
I3DObject, IFrame,
IFrame2 and IFrameEx.
See also Patchwork sample,
Interface List
HRESULT GetOrigin(double *x, double *y,
double *z)
Parameters
x, y, z- [out] references to variables
which will receive coordinates of the origin.
Remarks
Retrieve coordinates of the origin of the local frame.
HRESULT SetOrigin(double x, double y, double
z)
Parameters
x, y, z - [in] coordinates of new position of
the origin.
-
- Remarks:
Modifies position of the local frame.
HRESULT GetAxis(int axis, double *x, double *y,
double *z)
Parameters
int nAxis - [in] 0-based index of the
axis.
x, y, z- [out]
references to variables which will receive coordinates of the vector
in direction of the nAxis-th axis of the
local frame.
Return Values
-
- S_OK in case of success
-
- Remarks
-
- Returns coordinates of vector
which points in direction of the nAxis-th axis of the local
frame.
HRESULT Translate(double vx, double vy,
double vz)
Parameters
vx, vy, vz- [in] Coordinates of the
translation vector. Relative to the frame
- Remarks
-
-
- Call this method to translate origin of the local frame
along its x axis by vx, along y axis by vx and along z axis by vz.
Translation coordinates are relative to the current orientation of the frame,
not global coordinates
HRESULT TranslateGlobal(double vx,
double vy, double vz)
Parameters
vx, vy, vz- [in] Coordinates of the
translation translation vector in global frame
-
- Remarks:
Translates the frame relative to the global frame.
HRESULT Rotate(double angle, double xAxis,
double yAxis, double zAxis, double vxDirAxis, double vyDirAxis, double vzDirAxis)
Parameters
-
angle - [in] angle in
degrees to rotate by. angle can be negative.
xAxis,yAxis,zAxis- [in] point in local coordinates (relative
to this frame), where axis or rotation passes
through.
-
vxDirAxis, vxDirAxis, vxDirAxis - [in] vector in
local coordinates (relative to this frame) coordinates of
direction of the rotation axis
-
- Remarks
-
- Rotates the frame around an
arbitrary axis.
-
HRESULT RotateGlobal(double angle, double
xAxis, double yAxis, double zAxis, double vxDirAxis, double vyDirAxis, double
vzDirAxis)
Parameters
-
angle - [in] angle in
degrees to rotate by. anglecan be negative.
xAxis,yAxis,zAxis- [in] point in global coordinates, where axis or rotation passes
through.
-
vxDirAxis, vxDirAxis, vxDirAxis - [in] vector in
global coordinates of
direction of the rotation axis
-
Return
Values
S_OK in case of success
- Remarks
-
- Rotates the local frame around an
arbitrary axis in 3D space. The coordinates are relative to the global axes.
-
HRESULT SetAxes(int axisInd0, DIVect* axis0,
int axisInd1, DIVect* axis1)
Parameters
axisInd0 - [in] 0-based index of axis, which
will be changed to axis0.
axis0 - [in] 3D vector which will be set as axisInd0-th
axis of the frame. DIVect
type is described in Basic Types.
axisInd1 - [in] 0-based index of axis, which
will be changed to axis1.
axis1 - [in] 3D vector which will be set as axisInd1-th
axis of the frame. DIVect
type is described in Basic Types. Supplying
zero vector for this parameter means the axis is not specified. The method will
select an arbitrary orthogonal axis.
Returns
-
- S_OK in case of
success.
-
- DISP_E_PARAMNOTOPTIONAL in case axis0 or axis1 are
zero vectors or have the same direction
-
- Remarks
-
-
Call this method to set directions of axes of the frame. DIVect
type is described in Basic Types. Normally axis0
and axis1 are orthogonal vectors. They must not have the same
direction otherwise the method will fail with DISP_E_PARAMNOTOPTIONAL return
code. If axis0 and axis1 are not orthogonal orthogonalization is
applied to axis1. Supplying zero vector for axis1 parameter
means the axis is not specified. The method will select an arbitrary
orthogonal axis. In addition to that, both vectors are normalized to
make their lengths equal to 1.0. The third remaining axis is calculated using
the supplied ones and condition that it must be orthogonal to both of them and
have its length equal to 1.0.
HRESULT SetupAxes(int axis0, DIVect* axis,
int axis1)
Parameters
axis0 - [in]
0-based index of the axis, which will be directed along axis
-
axis1 - [in]
0-based index of the axis, which will be calculated second
- Remarks:
- Use this method to make sure that axis0 is
directed along axis. Direction of other axes will be modified by
making the current axis1 axis perpendicular to axis
axis0 and the last axis will be perpendicular to the others.
HRESULT Reset()
-
- Remarks:
Resets the frame to its default: After this call the frame will coincide
with the global frame .
HRESULT ResetOrientation()
-
- Remarks:
Restores default orientation of the frame: Aligns axes of the frame with the
global axes. Location of the frame remains unchanged
HRESULT Copy(IUnknown* frame)
Parameters
frame - [in]
I3DObject, IFrame,
IFrame2 or IFrame3 interface
implemented by the frame object to be copied.
-
- Remarks:
- This method will copy position and orientation of frame
into the frame, which implements this interface. For example, when this IFrame3
and frame are queried from two different object.
the first object will be located at the same point and oriented in the same way
as the second object.
HRESULT ToLocal(double *x, double *y, double
*z)
Parameters
x, y, z - [in, out] - coordinates of
a point to be converted to local frame
Returns
- S_OK in case of
success.
-
- Remarks:
This method allows conversion of 3D global coordinates to coordinates
relative to the local axes of the frame the interface was queried from.
HRESULT ToGlobal(double *x, double *y, double
*z)
Parameters
x, y, z - [in, out] - coordinates of
a point to be converted to local frame
-
- Remarks:
Converts coordinates relative to the local axes of
the frame the interface was queried from to 3D global coordinates.
HRESULT Push()
Stores internally position and orientation of this frame. Noramally called
before some modification to be able to restore with a Pop() call
HRESULT Pop()
Restores the last position and orientation stored with Push() call
HRESULT ToLocalVector(DIVect* vect)
Converts a global vector relative to these axes
HRESULT ToGlobalVector(DIVect* vect)
Assuming vect has coordinates relative the these axes converts them
to global axes
HRESULT ToLocalFrame(IFrame3* frame)
Makes frame relative to these axes. This means that coordinates of
axes and of the origin of frame as returned by
I3DObject will be relative the these axes
(the frame which implements this interface)
HRESULT ToGlobalFrame(IFrame3* frame)
Assimes that coordinates of frame are relative to this and converts them to global coordinates.
This method uses this.ToGlobal() to convert origin of frame and
this.ToGlobalVector() to convert all three axes of frame
HRESULT Invert()
Changes this frame in such way that it
becomes frame of the inverse transform. See
Transforms
|