@bitbybit-dev/base
Version:
Bit By Bit Developers Base CAD Library to Program Geometry
148 lines (147 loc) • 5.66 kB
TypeScript
import { Base } from "../inputs/base-inputs";
import * as Inputs from "../inputs";
import { MathBitByBit } from "./math";
import { Vector } from "./vector";
/**
* Transformations help to move, scale, rotate objects. You can combine multiple transformations
* for object to be placed exactly into position and orientation that you want.
* Contains various methods for transformations that represent 4x4 matrixes in flat 16 number arrays.
*/
export declare class Transforms {
private readonly vector;
private readonly math;
constructor(vector: Vector, math: MathBitByBit);
/**
* Creates a rotation transformations around the center and an axis
* @param inputs Rotation around center with an axis information
* @returns array of transformations
* @group rotation
* @shortname center axis
* @drawable false
*/
rotationCenterAxis(inputs: Inputs.Transforms.RotationCenterAxisDto): Base.TransformMatrixes;
/**
* Creates a rotation transformations around the center and an X axis
* @param inputs Rotation around center with an X axis information
* @returns array of transformations
* @group rotation
* @shortname center x
* @drawable false
*/
rotationCenterX(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
/**
* Creates a rotation transformations around the center and an Y axis
* @param inputs Rotation around center with an Y axis information
* @returns array of transformations
* @group rotation
* @shortname center y
* @drawable false
*/
rotationCenterY(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
/**
* Creates a rotation transformations around the center and an Z axis
* @param inputs Rotation around center with an Z axis information
* @returns array of transformations
* @group rotation
* @shortname center z
* @drawable false
*/
rotationCenterZ(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
/**
* Creates a rotation transformations with yaw pitch and roll
* @param inputs Yaw pitch roll rotation information
* @returns array of transformations
* @group rotation
* @shortname yaw pitch roll
* @drawable false
*/
rotationCenterYawPitchRoll(inputs: Inputs.Transforms.RotationCenterYawPitchRollDto): Base.TransformMatrixes;
/**
* Scale transformation around center and xyz directions
* @param inputs Scale center xyz trnansformation
* @returns array of transformations
* @group rotation
* @shortname center xyz
* @drawable false
*/
scaleCenterXYZ(inputs: Inputs.Transforms.ScaleCenterXYZDto): Base.TransformMatrixes;
/**
* Creates the scale transformation in x, y and z directions
* @param inputs Scale XYZ number array information
* @returns transformation
* @group scale
* @shortname xyz
* @drawable false
*/
scaleXYZ(inputs: Inputs.Transforms.ScaleXYZDto): Base.TransformMatrixes;
/**
* Creates a stretch transformation along a specific direction, relative to a center point.
* This scales points along the given direction vector while leaving points in the
* plane perpendicular to the direction (passing through the center) unchanged.
* @param inputs Defines the center, direction, and scale factor for the stretch.
* @returns Array of transformations: [Translate To Origin, Stretch, Translate Back].
* @group scale
* @shortname stretch dir center
* @drawable false
*/
stretchDirFromCenter(inputs: Inputs.Transforms.StretchDirCenterDto): Base.TransformMatrixes;
/**
* Creates uniform scale transformation
* @param inputs Scale Dto
* @returns transformation
* @group scale
* @shortname uniform
* @drawable false
*/
uniformScale(inputs: Inputs.Transforms.UniformScaleDto): Base.TransformMatrixes;
/**
* Creates uniform scale transformation from the center
* @param inputs Scale Dto with center point information
* @returns array of transformations
* @group scale
* @shortname uniform from center
* @drawable false
*/
uniformScaleFromCenter(inputs: Inputs.Transforms.UniformScaleFromCenterDto): Base.TransformMatrixes;
/**
* Creates the translation transformation
* @param inputs Translation information
* @returns transformation
* @group translation
* @shortname xyz
* @drawable false
*/
translationXYZ(inputs: Inputs.Transforms.TranslationXYZDto): Base.TransformMatrixes;
/**
* Creates the translation transformation
* @param inputs Translation information
* @returns transformation
* @group translations
* @shortname xyz
* @drawable false
*/
translationsXYZ(inputs: Inputs.Transforms.TranslationsXYZDto): Base.TransformMatrixes[];
/**
* Creates the identity transformation
* @returns transformation
* @group identity
* @shortname identity
* @drawable false
*/
identity(): Base.TransformMatrix;
private translation;
private scaling;
private rotationAxis;
private rotationX;
private rotationY;
private rotationZ;
private rotationYawPitchRoll;
private rotationMatrixFromQuat;
/**
* Creates a 4x4 matrix that scales along a given direction vector.
* @param direction The direction vector (will be normalized).
* @param scale The scale factor along the direction.
* @returns A 4x4 column-major transformation matrix.
*/
private stretchDirection;
}