L_VecSetRotation

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecSetRotation(pVector, pRotation, pObject, pOrigin, dwFlags)

pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTORPOINT pRotation;

/* pointer to a vector point */

pVECTOROBJECT pObject;

/* pointer to a vector object */

const pVECTORPOINT pOrigin;

/* pointer to a vector point */

L_UINT32 dwFlags;

/* flag that indicates which objects to rotate */

Rotates all or part of the specified vector image. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pVector

Pointer to a vector handle.

pRotation

Pointer to a VECTORPOINT structure that contains the rotation values for each axis. The rotation values are in degrees.

pObject

Pointer to a VECTOROBJECT structure that references the object to rotate. If this parameter is not NULL, only the specified object will be rotated. If this parameter is NULL, the objects to rotate are determined by dwFlags.

pOrigin

Pointer to a VECTORPOINT structure that contains the center of rotation. If pOrigin is not NULL, rotation occurs around this point. If pOrigin is NULL, the center of rotation is the accumulative center of the objects to be rotated.

dwFlags

Flag that indicates which objects to rotate. This flag is valid only if pObject is NULL. If pObject is not NULL, this parameter is ignored. Possible values are:

 

Value

Meaning

 

0

Rotate all objects.

 

VECTOR_FLAGS_SELECTED_ONLY

Rotate only the currently selected objects within the vector handle.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Rotates all or part of the specified vector image based on the rotation values in pRotation.

The translation values may be retrieved using L_VecGetRotation.

You should call L_VecApplyTransformation to make the rotation part of the vector image, if you dont your changes will not be saved.

Note: When you rotate an object, it may or may not effect other unselected objects sharing vertices with the selected object. This depends on the current bind vertices mode set by L_VecSetBindVerticesMode.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_VecGetRotation, L_VecSetScale, L_VecGetScale, L_VecSetTranslation, L_VecGetTranslation, L_VecSetBindVerticesMode, L_VecGetBindVerticesMode, L_VecApplyTransformation

Example

This example will rotate all objects in a vector handle by 30 degrees along the x-axis, -20 degrees the y-axis and +50 degrees along the z-axis.

L_INT VecSetRotationExample(pVECTORHANDLE pVector)
{
   L_INT nRet;
   VECTORPOINT rotation;

   /* Get current rotation values */
   nRet = L_VecGetRotation( pVector, &rotation );
   if(nRet != SUCCESS)
      return nRet;

   /* +30 degrees along the x-axis */
   rotation.x += 30.0;
   /* -20 degrees along the y-axis */
   rotation.y -= 20.0;
   /* +50 degrees along the z-axis */
   rotation.z += 50.0;

   /* Set new rotation values. Note that we will rotate around the center of the drawing */
   nRet = L_VecSetRotation( pVector, &rotation, NULL, NULL, 0L );

   return nRet;
}