@bitbybit-dev/base
Version:
Bit By Bit Developers Base CAD Library to Program Geometry
732 lines (731 loc) • 22.5 kB
JavaScript
export var Point;
(function (Point) {
class PointDto {
constructor(point) {
if (point !== undefined) {
this.point = point;
}
}
}
Point.PointDto = PointDto;
class PointXYZDto {
constructor(x, y, z) {
/**
* Point
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.x = 0;
/**
* Point
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.y = 0;
/**
* Point
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.z = 0;
if (x !== undefined) {
this.x = x;
}
if (y !== undefined) {
this.y = y;
}
if (z !== undefined) {
this.z = z;
}
}
}
Point.PointXYZDto = PointXYZDto;
class PointXYDto {
constructor(x, y) {
/**
* Point
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.x = 0;
/**
* Point
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
this.y = 0;
if (x !== undefined) {
this.x = x;
}
if (y !== undefined) {
this.y = y;
}
}
}
Point.PointXYDto = PointXYDto;
class PointsDto {
constructor(points) {
if (points !== undefined) {
this.points = points;
}
}
}
Point.PointsDto = PointsDto;
class TwoPointsDto {
constructor(point1, point2) {
if (point1 !== undefined) {
this.point1 = point1;
}
if (point2 !== undefined) {
this.point2 = point2;
}
}
}
Point.TwoPointsDto = TwoPointsDto;
class DrawPointDto {
/**
* Provide options without default values
*/
constructor(point, opacity, size, colours, updatable, pointMesh) {
/**
* Value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
this.opacity = 1;
/**
* Size of the point
* @default 3
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.size = 3;
/**
* Hex colour string
* @default #444444
*/
this.colours = "#444444";
/**
* Indicates wether the position of this point will change in time
* @default false
*/
this.updatable = false;
if (point !== undefined) {
this.point = point;
}
if (opacity !== undefined) {
this.opacity = opacity;
}
if (size !== undefined) {
this.size = size;
}
if (colours !== undefined) {
this.colours = colours;
}
if (updatable !== undefined) {
this.updatable = updatable;
}
if (pointMesh !== undefined) {
this.pointMesh = pointMesh;
}
}
}
Point.DrawPointDto = DrawPointDto;
class DrawPointsDto {
/**
* Provide options without default values
*/
constructor(points, opacity, size, colours, updatable, pointsMesh) {
/**
* Value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
this.opacity = 1;
/**
* Size of the points
* @default 0.1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.size = 0.1;
/**
* Hex colour string or collection of strings
* @default #444444
*/
this.colours = "#444444";
/**
* Indicates wether the position of this point will change in time
* @default false
*/
this.updatable = false;
if (points !== undefined) {
this.points = points;
}
if (opacity !== undefined) {
this.opacity = opacity;
}
if (size !== undefined) {
this.size = size;
}
if (colours !== undefined) {
this.colours = colours;
}
if (updatable !== undefined) {
this.updatable = updatable;
}
if (pointsMesh !== undefined) {
this.pointsMesh = pointsMesh;
}
}
}
Point.DrawPointsDto = DrawPointsDto;
class TransformPointDto {
constructor(point, transformation) {
if (point !== undefined) {
this.point = point;
}
if (transformation !== undefined) {
this.transformation = transformation;
}
}
}
Point.TransformPointDto = TransformPointDto;
class TransformPointsDto {
constructor(points, transformation) {
if (points !== undefined) {
this.points = points;
}
if (transformation !== undefined) {
this.transformation = transformation;
}
}
}
Point.TransformPointsDto = TransformPointsDto;
class TranslatePointsWithVectorsDto {
constructor(points, translations) {
if (points !== undefined) {
this.points = points;
}
if (translations !== undefined) {
this.translations = translations;
}
}
}
Point.TranslatePointsWithVectorsDto = TranslatePointsWithVectorsDto;
class TranslatePointsDto {
constructor(points, translation) {
if (points !== undefined) {
this.points = points;
}
if (translation !== undefined) {
this.translation = translation;
}
}
}
Point.TranslatePointsDto = TranslatePointsDto;
class TranslateXYZPointsDto {
constructor(points, x, y, z) {
/**
* X vector value
* @default 0
*/
this.x = 0;
/**
* Y vector value
* @default 1
*/
this.y = 1;
/**
* Z vector value
* @default 0
*/
this.z = 0;
if (points !== undefined) {
this.points = points;
}
if (x !== undefined) {
this.x = x;
}
if (y !== undefined) {
this.y = y;
}
if (z !== undefined) {
this.z = z;
}
}
}
Point.TranslateXYZPointsDto = TranslateXYZPointsDto;
class ScalePointsCenterXYZDto {
constructor(points, 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 (points !== undefined) {
this.points = points;
}
if (center !== undefined) {
this.center = center;
}
if (scaleXyz !== undefined) {
this.scaleXyz = scaleXyz;
}
}
}
Point.ScalePointsCenterXYZDto = ScalePointsCenterXYZDto;
class StretchPointsDirFromCenterDto {
constructor(points, center, direction, scale) {
/**
* The center from which the scaling is applied
* @default [0, 0, 0]
*/
this.center = [0, 0, 0];
/**
* Stretch direction vector
* @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 (points !== undefined) {
this.points = points;
}
if (center !== undefined) {
this.center = center;
}
if (direction !== undefined) {
this.direction = direction;
}
if (scale !== undefined) {
this.scale = scale;
}
}
}
Point.StretchPointsDirFromCenterDto = StretchPointsDirFromCenterDto;
class RotatePointsCenterAxisDto {
constructor(points, 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 (points !== undefined) {
this.points = points;
}
if (angle !== undefined) {
this.angle = angle;
}
if (axis !== undefined) {
this.axis = axis;
}
if (center !== undefined) {
this.center = center;
}
}
}
Point.RotatePointsCenterAxisDto = RotatePointsCenterAxisDto;
class TransformsForPointsDto {
constructor(points, transformation) {
if (points !== undefined) {
this.points = points;
}
if (transformation !== undefined) {
this.transformation = transformation;
}
}
}
Point.TransformsForPointsDto = TransformsForPointsDto;
class ThreePointsNormalDto {
constructor(point1, point2, point3, reverseNormal) {
/**
* Reverse normal direction
* @default false
*/
this.reverseNormal = false;
if (point1 !== undefined) {
this.point1 = point1;
}
if (point2 !== undefined) {
this.point2 = point2;
}
if (point3 !== undefined) {
this.point3 = point3;
}
if (reverseNormal !== undefined) {
this.reverseNormal = reverseNormal;
}
}
}
Point.ThreePointsNormalDto = ThreePointsNormalDto;
class ThreePointsToleranceDto {
constructor(start, center, end, tolerance) {
/**
* Tolerance for the calculation
* @default 1e-7
* @minimum -Infinity
* @maximum Infinity
* @step 1e-7
*/
this.tolerance = 1e-7;
if (start !== undefined) {
this.start = start;
}
if (center !== undefined) {
this.center = center;
}
if (end !== undefined) {
this.end = end;
}
if (tolerance !== undefined) {
this.tolerance = tolerance;
}
}
}
Point.ThreePointsToleranceDto = ThreePointsToleranceDto;
class PointsMaxFilletsHalfLineDto {
constructor(points, checkLastWithFirst, tolerance) {
/**
* Check first and last point for duplicates
* @default false
*/
this.checkLastWithFirst = false;
/**
* Tolerance for the calculation
* @default 1e-7
* @minimum -Infinity
* @maximum Infinity
* @step 1e-7
*/
this.tolerance = 1e-7;
if (points !== undefined) {
this.points = points;
}
if (checkLastWithFirst !== undefined) {
this.checkLastWithFirst = checkLastWithFirst;
}
if (tolerance !== undefined) {
this.tolerance = tolerance;
}
}
}
Point.PointsMaxFilletsHalfLineDto = PointsMaxFilletsHalfLineDto;
class RemoveConsecutiveDuplicatesDto {
constructor(points, tolerance, checkFirstAndLast) {
/**
* Tolerance for removing duplicates
* @default 1e-7
* @minimum 0
* @maximum Infinity
* @step 1e-7
*/
this.tolerance = 1e-7;
/**
* Check first and last point for duplicates
*/
this.checkFirstAndLast = false;
if (points !== undefined) {
this.points = points;
}
if (tolerance !== undefined) {
this.tolerance = tolerance;
}
if (checkFirstAndLast !== undefined) {
this.checkFirstAndLast = checkFirstAndLast;
}
}
}
Point.RemoveConsecutiveDuplicatesDto = RemoveConsecutiveDuplicatesDto;
class ClosestPointFromPointsDto {
constructor(points, point) {
if (points !== undefined) {
this.points = points;
}
if (point !== undefined) {
this.point = point;
}
}
}
Point.ClosestPointFromPointsDto = ClosestPointFromPointsDto;
class TwoPointsToleranceDto {
constructor(point1, point2, tolerance) {
/**
* Tolerance for the calculation
* @default 1e-7
* @minimum -Infinity
* @maximum Infinity
* @step 1e-7
*/
this.tolerance = 1e-7;
if (point1 !== undefined) {
this.point1 = point1;
}
if (point2 !== undefined) {
this.point2 = point2;
}
if (tolerance !== undefined) {
this.tolerance = tolerance;
}
}
}
Point.TwoPointsToleranceDto = TwoPointsToleranceDto;
class StartEndPointsDto {
constructor(startPoint, endPoint) {
if (startPoint !== undefined) {
this.startPoint = startPoint;
}
if (endPoint !== undefined) {
this.endPoint = endPoint;
}
}
}
Point.StartEndPointsDto = StartEndPointsDto;
class StartEndPointsListDto {
constructor(startPoint, endPoints) {
if (startPoint !== undefined) {
this.startPoint = startPoint;
}
if (endPoints !== undefined) {
this.endPoints = endPoints;
}
}
}
Point.StartEndPointsListDto = StartEndPointsListDto;
class MultiplyPointDto {
constructor(point, amountOfPoints) {
if (point !== undefined) {
this.point = point;
}
if (amountOfPoints !== undefined) {
this.amountOfPoints = amountOfPoints;
}
}
}
Point.MultiplyPointDto = MultiplyPointDto;
class SpiralDto {
constructor(radius, numberPoints, widening, factor, phi) {
/**
* Identifies phi angle
* @default 0.9
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.phi = 0.9;
/**
* Identifies how many points will be created
* @default 200
* @minimum 0
* @maximum Infinity
* @step 10
*/
this.numberPoints = 200;
/**
* Widening factor of the spiral
* @default 3
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.widening = 3;
/**
* Radius of the spiral
* @default 6
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.radius = 6;
/**
* Factor of the spiral
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.factor = 1;
if (radius !== undefined) {
this.radius = radius;
}
if (numberPoints !== undefined) {
this.numberPoints = numberPoints;
}
if (widening !== undefined) {
this.widening = widening;
}
if (factor !== undefined) {
this.factor = factor;
}
if (phi !== undefined) {
this.phi = phi;
}
}
}
Point.SpiralDto = SpiralDto;
class HexGridScaledToFitDto {
constructor(wdith, height, nrHexagonsU, nrHexagonsV, centerGrid, pointsOnGround) {
/** Total desired width for the grid area. The hexagon size will be derived from this and nrHexagonsU.
* @default 10
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.width = 10;
/** Total desired height for the grid area. Note: due to hexagon geometry, the actual grid height might differ slightly if maintaining regular hexagons based on width.
* @default 10
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
this.height = 10;
/** Number of hexagons desired in width.
* @default 10
* @minimum 0
* @maximum Infinity
* @step 1
*/
this.nrHexagonsInWidth = 10;
/** Number of hexagons desired in height.
* @default 10
* @minimum 0
* @maximum Infinity
* @step 1
*/
this.nrHexagonsInHeight = 10;
/** If true, the hexagons will be oriented with their flat sides facing up and down.
* @default false
*/
this.flatTop = false;
/** If true, shift the entire grid up by half hex height.
* @default false
*/
this.extendTop = false;
/** If true, shift the entire grid down by half hex height.
* @default false
*/
this.extendBottom = false;
/** If true, shift the entire grid left by half hex width.
* @default false
*/
this.extendLeft = false;
/** If true, shift the entire grid right by half hex width.
* @default false
*/
this.extendRight = false;
/** If true, the grid center (based on totalWidth/totalHeight) will be at [0,0,0].
* @default false
*/
this.centerGrid = false;
/** If true, swaps Y and Z coordinates and sets Y to 0, placing points on the XZ ground plane.
* @default false
*/
this.pointsOnGround = false;
if (wdith !== undefined) {
this.width = wdith;
}
if (height !== undefined) {
this.height = height;
}
if (nrHexagonsU !== undefined) {
this.nrHexagonsInHeight = nrHexagonsU;
}
if (nrHexagonsV !== undefined) {
this.nrHexagonsInWidth = nrHexagonsV;
}
if (centerGrid !== undefined) {
this.centerGrid = centerGrid;
}
if (pointsOnGround !== undefined) {
this.pointsOnGround = pointsOnGround;
}
}
}
Point.HexGridScaledToFitDto = HexGridScaledToFitDto;
class HexGridCentersDto {
constructor(nrHexagonsX, nrHexagonsY, radiusHexagon, orientOnCenter, pointsOnGround) {
/**
* Number of hexagons on Y direction
* @default 21
* @minimum 0
* @maximum Infinity
* @step 1
*/
this.nrHexagonsY = 21;
/**
* Number of Hexagons on Z direction
* @default 21
* @minimum 0
* @maximum Infinity
* @step 1
*/
this.nrHexagonsX = 21;
/**
* Orient hexagon points grid on center
* @default false
*/
this.orientOnCenter = false;
/**
* Orient points on the ground
* @default false
*/
this.pointsOnGround = false;
if (nrHexagonsX !== undefined) {
this.nrHexagonsX = nrHexagonsX;
}
if (nrHexagonsY !== undefined) {
this.nrHexagonsY = nrHexagonsY;
}
if (radiusHexagon !== undefined) {
this.radiusHexagon = radiusHexagon;
}
if (orientOnCenter !== undefined) {
this.orientOnCenter = orientOnCenter;
}
if (pointsOnGround !== undefined) {
this.pointsOnGround = pointsOnGround;
}
}
}
Point.HexGridCentersDto = HexGridCentersDto;
})(Point || (Point = {}));