DInsight Home
Movements

# Movements

A Movement in KernelCAD software is a rule which for every moment of time gives a frame of axes. Movement can be applied to sections (Objects). Position and orientation of a section at a moment of time is defined by making local frame of the section identical to the frame defined by the movement. In more scientific terms a movement is a parameterized frame or curve in space of frames: F: [0,1] -> (space of frames);  t -> F(t).

Movement of sections described above is called absolute because it does not depend on the initial position of the section. A movement can be considered as  relative to the current position of the mobile object. It is defined as next: Calculate coordinates of the object relative to the initial frame F(0). Position of the object at moment t is the object with the same coordinates in frame F(t). This type of movement changes initial position of the mobile object continuously.

Relative movements can be applied to various types of object slike points, vectors,  frames and sections. See more details about movements of sections in Kinematic Sections.

Time related to movements is always normalized, i.e. moment 0 is the start and 1 is the end. If an application has a different range it can be mapped linearly to [0, 1] range to make it normalized.

If one considers components of the movement frame a Movement is defined by three curves in space: x(t), u(t) and v(t) where parameter t has range [0, 1]. x(t) is the origin of the frame at moment t, u(t) is vector of x axis of the frame and v(t) is vector of y axis of the frame. x(t) is called path of the movement.

Movements are controlled by IMove_KC interface.

Any curves in KernelCAD software are currently sampled by an array of 3D points x[0], x[1], ...,x[n]. which correspond to array of parameters t[0], t[1], ..., t[n]. Behavior of the curve between the points is defined by its type and some additional parameters like interpolation degree. When size of the array x is the same and parameter arrays are identical for x, u and v curves the above defines array of frames f[0], f[1], ..., f[n]. This is the default case, which is always true when the move has been initialized with IMove_KC.CreateAttributes and possibly modified with IFrameArray..

This above frame array can be accessed and modified via IFrameArray queried from IMove_KC

To create a new Movement:

1. Query IMove_KC from the return of IDIObjGenerator.Create called with eType parameter set to eObjTypeMove member of the EObjectType enumeration.

2. Call IMove_KC.CreateAttributes to create a default movement or attach the three curves described above, which where created independently using IMove_KC.SetOriginPath and IMove_KC.SetAxisPath methods.

3. Modify if required the curves independently as described in Geometric Curves topic or use IFrameArray queried from IMove_KC to access complete frames at each sampling data point. For the later method to work all curves must have the same size of the data array. This is true if the curves where created with a IMove_KC.CreateAttributes call and possibly modified with IFrameArray.

Before using a movement all three curves must be created either with call to IMove_KC.CreateAttributes or attached with calls to IMove_KC.SetOriginPath and IMove_KC.SetAxisPath.

Generally curves x, u, v can have different types, different number of sampling points and different parameterization. If the curves where created with a call to IMove_KC.CreateAttributes(0) all three curves are Free-form curves linearly interpolated between sampling points. If different parameter was supplied in IMove_KC.CreateAttributes call the lines will have more complex type normally derived from Free-form curves. See also IMove_KC.CreateAttributes.

A simpler way to define a movement is to create it as a canonical movement associated with a 3D curve (path):

## Canonical movement of a path

Movement can be constacted from a 3D curve as described below. Movements constructed this way are called canonical because proerties of the moving frame are derived form the path of the movement.

For every moment t x axis of the moving frame F(t) is defined as tangential to the path x(t). If the path x(t) is brocken at the point there are two smooth adjacent pieces of the curve at the point so the tangential of the piece after the point is taken.

z  axis of the moving frame F(t) is defined as follows:

For Arc Spline curves z axis coinsides with the normal of the plane of the spline at the point x(t)

For a general path if the curve has non zero curvature at the point z axis is perpendicular to the tangential circle. If the curvature is zero, direction z is take from the previous or next (in this order) non zero curvature point. If whole curve is a straight line z direction is defined by making x global axis perpendicular to the tangential vector. if this is not possible y and z global axes are attempted

y axis of the moving frame is defined as orthogonal to x and z.

To construct a canonical movement define the path of the movement and call IMove_KC.DefineTangentail()