@bitbybit-dev/base
Version:
Bit By Bit Developers Base CAD Library to Program Geometry
230 lines (229 loc) • 7.29 kB
JavaScript
export var Transforms;
(function (Transforms) {
class RotationCenterAxisDto {
constructor(angle, axis, center) {
/**
* Angle of rotation in degrees
* @default 90
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
this.angle = 90;
/**
* Axis vector for rotation
* @default [0, 1, 0]
*/
this.axis = [0, 1, 0];
/**
* The center from which the axis is pointing
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
if (angle !== undefined) {
this.angle = angle;
}
if (axis !== undefined) {
this.axis = axis;
}
if (center !== undefined) {
this.center = center;
}
}
}
Transforms.RotationCenterAxisDto = RotationCenterAxisDto;
class RotationCenterDto {
constructor(angle, center) {
/**
* Angle of rotation in degrees
* @default 90
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
this.angle = 90;
/**
* The center from which the axis is pointing
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
if (angle !== undefined) {
this.angle = angle;
}
if (center !== undefined) {
this.center = center;
}
}
}
Transforms.RotationCenterDto = RotationCenterDto;
class RotationCenterYawPitchRollDto {
constructor(yaw, pitch, roll, center) {
/**
* Yaw angle (Rotation around X) in degrees
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
this.yaw = 0;
/**
* Pitch angle (Rotation around Y) in degrees
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
this.pitch = 0;
/**
* Roll angle (Rotation around Z) in degrees
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
this.roll = 0;
/**
* The center from which the rotations are applied
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
if (yaw !== undefined) {
this.yaw = yaw;
}
if (pitch !== undefined) {
this.pitch = pitch;
}
if (roll !== undefined) {
this.roll = roll;
}
if (center !== undefined) {
this.center = center;
}
}
}
Transforms.RotationCenterYawPitchRollDto = RotationCenterYawPitchRollDto;
class ScaleXYZDto {
constructor(scaleXyz) {
/**
* Scaling factors for each axis [1, 2, 1] means that Y axis will be scaled 200% and both x and z axis will remain on 100%
* @default [1, 1, 1]
*/
this.scaleXyz = [1, 1, 1];
if (scaleXyz !== undefined) {
this.scaleXyz = scaleXyz;
}
}
}
Transforms.ScaleXYZDto = ScaleXYZDto;
class StretchDirCenterDto {
constructor(scale, center, direction) {
/** The center point around which to stretch.
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
/** The direction vector along which to stretch. Does not need to be normalized initially.
* @default [0, 0, 1]
*/
this.direction = [0, 0, 1];
/** The scale factor to apply along the direction vector. 1.0 means no change.
* @default 2
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.scale = 2;
if (scale !== undefined) {
this.scale = scale;
}
if (center !== undefined) {
this.center = center;
}
if (direction !== undefined) {
this.direction = direction;
}
}
}
Transforms.StretchDirCenterDto = StretchDirCenterDto;
class ScaleCenterXYZDto {
constructor(center, scaleXyz) {
/**
* The center from which the scaling is applied
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
/**
* Scaling factors for each axis [1, 2, 1] means that Y axis will be scaled 200% and both x and z axis will remain on 100%
* @default [1, 1, 1]
*/
this.scaleXyz = [1, 1, 1];
if (center !== undefined) {
this.center = center;
}
if (scaleXyz !== undefined) {
this.scaleXyz = scaleXyz;
}
}
}
Transforms.ScaleCenterXYZDto = ScaleCenterXYZDto;
class UniformScaleDto {
constructor(scale) {
/**
* Uniform scale factor for all x, y, z directions. 1 will keep everything on original size, 2 will scale 200%;
* @default 1
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.scale = 1;
if (scale !== undefined) {
this.scale = scale;
}
}
}
Transforms.UniformScaleDto = UniformScaleDto;
class UniformScaleFromCenterDto {
constructor(scale, center) {
/**
* Scale factor for all x, y, z directions. 1 will keep everything on original size, 2 will scale 200%;
* @default 1
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.scale = 1;
/**
* Center position of the scaling
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
if (scale !== undefined) {
this.scale = scale;
}
if (center !== undefined) {
this.center = center;
}
}
}
Transforms.UniformScaleFromCenterDto = UniformScaleFromCenterDto;
class TranslationXYZDto {
constructor(translation) {
/**
* Translation vector with [x, y, z] distances
* @default [0, 0, 0]
*/
this.translation = [0, 0, 0];
if (translation !== undefined) {
this.translation = translation;
}
}
}
Transforms.TranslationXYZDto = TranslationXYZDto;
class TranslationsXYZDto {
constructor(translations) {
if (translations !== undefined) {
this.translations = translations;
}
}
}
Transforms.TranslationsXYZDto = TranslationsXYZDto;
})(Transforms || (Transforms = {}));