Transformations   

<<< Lattice Geometry Chapters Assemblies And Instances >>>

Contents

[back to top]


21.1 Introduction

The Parasolid PK interface supports homogenous coordinate transformations. These allow translation, scale (equal and non-uniform), rotation, shear and reflection transformations to be specified. These transformations can then be combined to give more general transformations.

Transformations can be applied to individual geometrical entities or to whole bodies. Transformations can also be checked for validity, and classified by class.

 

Note: Throughout this chapter, transformations are assumed to be supplied in the form of a 4x4 matrix. For more details, see PK_TRANSF_sf_t.

 

Related Topics:

[back to top]


21.2 Creating transformations

Many of the basic transformations are available directly via:

In addition to these functions, PK_TRANSF_create allows you to create any transformation directly. For example, a non-uniform scaling of 2 in X, 3 in Y and 4 in Z can be generated from the PK_TRANSF_create function with matrix:

( 2 0 0 0 )
( 0 3 0 0 )
( 0 0 4 0 )
( 0 0 0 1 )

as input. The documentation of the standard form, PK_TRANSF_sf_t, explains the mathematics underlying this matrix. Parasolid currently does not allow perspective terms in transformations used in modeling operations. This means that the first 3 elements of the 4th column of the matrix must be zero.

The upper left 3x3 sub-matrix of any 4x4 transformation matrix represents the component of the transformation that is a linear transformation. This is referred to as the linear transformation matrix. For more details, see PK_TRANSF_sf_t.

Transformations can be combined and manipulated using PK_TRANSF_transform_2.

Parasolid supports large transformations (i.e where the entity lies within the size box but can be positioned by a large transform outside the size box).This can be useful for example in factory design when deciding where to position objects (such as machinery) around the factory. Each component of the factory is “small” but the factory itself may extend to a few kilometers in size.

Large transformations cannot be applied to geometry or topology but they can be passed into certain Parasolid API that accept transformations as input. These include:

In order to maintain accuracy when working with large transformations, we recommend you use the specific transformation functions PK_TRANSF_create_equal_scale, PK_TRANSF_create_reflection and PK_TRANSF_create_rotation to create the necessary transformations and PK_TRANSF_transform_2 to combine them.

If you are interested in implementing large transformations in your application, please contact Parasolid Support for more information.

[back to top]


21.3 Applying transformations

Transformations can be applied to geometry, bodies, assemblies, instances, vectors and faces.

[back to top]


21.4 Transforming geometry

You can use PK_GEOM_transform_2 to transform an array of geometric entities, either by modifying the original entities, or by modifying copies of them. It receives an array of geometries, a transformation and a set of options. It can return transformed copies of the supplied geometry, together with information about whether each copy is an exact transformation of the original or not.

PK_GEOM_transform_2 takes options that let you control the behaviour of the function as follows:

 

Option

Description

tolerance

If a geometric entity cannot be transformed exactly, this is the tolerance to which the new geometry matches the original.

Whether an exact result is possible depends on both the type of transformation and the class of the geometry. For example, for surfaces:

  • Planes can always be transformed to planes.
  • Spheres can always be exactly transformed but may result in B-surfaces.
  • B-surfaces can always be exactly transformed.
  • Offset surfaces usually transform to approximate B-surfaces.
modify

Whether to create new geometric entities, or to modify the originals.

  • Modifying the originals is useful if, for instance, you want to ensure that the Parasolid tags for each entity remain unchanged.
  • Creating new entities means that, for example, you can transform the surfaces of faces in a body without affecting the integrity of the original body.
Note: If you modify the original geometry, and you attempt a transformation that either produces a non-exact result, or changes the geometry type (e.g. a sphere becomes a B-surface), then the operation fails.

want_out_geoms

Whether to return transformed geometry in an out_geoms array. If this is PK_LOGICAL_true, then:

  • If you are modifying the original geometry, then out_geoms contains a list of the original geometry.
  • If you are transforming copies of the original geometry, then out_geoms contains the resulting transformed geometry.
want_exact

Whether to return information indicating whether each geometry has been transformed exactly, or to within the specified tolerance. If PK_LOGICAL_true, then PK_GEOM_transform_2 returns an exact array of PK_LOGICAL_t tokens, one for each transformed geometry.

[back to top]


21.5 Transforming bodies

PK_BODY_transform_2 takes a sheet or solid body, a transformation and a tolerance for geometry which may have to be approximated.

The body is transformed. Face surfaces and edge curves may have to be approximated in order to achieve the desired result. Intersection curves are recalculated between transformed face surfaces unless the intersection and face surfaces can be transformed exactly.

It can happen that edges and vertices become tolerant as a result of this operation. For example, a smooth edge between faces often transforms to a tolerant smooth edge. Some topology changes, such as the elimination of edges made too short by transformation, are supported.

 

Note: The order in which transformations are applied is important, e.g. a rotation of 90 degrees about the Z axis followed by a translation of (1 0 0) is not the same as a translation of (1 0 0) followed by a rotation of 90 degrees about the Z axis.

[back to top]


21.6 Transforming other entities

As well as bodies and geometry, you can apply transformations to other entities using the following functions:

[back to top]


21.7 Checking and classifying transformations

You can use PK_TRANSF_check to perform a simple validity check on a given transformation. This function returns limited information about any faults found in the transformation, if any.

PK_TRANSF_classify is a more comprehensive API that complements the basic validity checking of PK_TRANSF_check. PK_TRANSF_classify can tell you the class of a transformation and (optionally) provide details about how the transformation deviates from the orthonormal state for that class.

PK functions that receive transformations as arguments have their own requirements on the classification of transformation that they accept. Please refer to the relevant API for further information. Where a received transformation is rejected, you can use PK_TRANSF_classify to provide additional information to help you diagnose the cause.

PK_TRANSF_classify returns the following information:

 

Field

Description

matrix_type

The class of the linear transformation matrix (this is the upper left 3x3 matrix of the supplied transformation: see Section 21.2).

determinant

The determinant of the linear transformation matrix.

unit_rows_deviations

The signed deviations from 1.0 of the squared norms of the rows of the linear transformation matrix.

orthog_rows_deviation

The signed deviations from 0.0 of the dot products between the rows of the linear transformation matrix.

translation

The translation vector of the supplied transformation.

perspective

The perspective vector of the supplied transformation

scale

The reciprocal of the global scale factor corresponding to the bottom right corner value of the transformation. The transformation is shrinking if this value is < 1.0 and expanding if this value is > 1.0,

The returned matrix_type is one of the following:

 

Field

Description

PK_matrix_type_identity_c

The linear transformation is the identity matrix.

PK_matrix_type_rotation_c

The linear transformation is a rotation matrix.

PK_matrix_type_reflection_c

The linear transformation is an orthonormal matrix that includes a reflection (i.e. the determinant is -1).

PK_matrix_type_general_c

The linear transformation is valid (according to PK_TRANSF_check), but contains local scaling information.

PK_matrix_type_unclassified_c

The linear transformation cannot be classified.

By default, PK_TRANSF_classify does not return either unit_rows_deviations or orthog_rows_deviations . These values are only returned if the diagnostics option is PK_TRANSF_diagnostics_all_c.

See PK_TRANSF_classify for more information.

[back to top]

<<< Lattice Geometry Chapters Assemblies And Instances >>>