Project
Method: point.project(angle, distance)
Parameters:
angle— bearing direction in radians (measured counter-clockwise from the positive \(x\)-axis)distance— how far to travel along that bearing
Returns: Point
Description
project moves a point a given distance along a direction specified as an
angle. Starting from point \(P\), the new point \(P'\) is:
where \(d\) is the distance and \(\theta\) is the angle in radians.
This is equivalent to expressing the displacement in polar coordinates \((d,\,\theta)\) and adding it to the Cartesian position of \(P\).
Angle reference
Angles follow the standard mathematical convention: \(0\) points along the positive \(x\)-axis (east), increasing counter-clockwise.
Angle |
Direction |
|---|---|
0 |
East (positive \(x\)) |
π / 2 |
North (positive \(y\)) |
π |
West (negative \(x\)) |
3π / 2 |
South (negative \(y\)) |
Implementation
project(angle, distance) {
if (angle === 0) {
return new Point(this.x, this.y).add(new Point(distance, 0));
}
const x = this.x + Math.cos(angle) * distance;
const y = this.y + Math.sin(angle) * distance;
return new Point(x, y);
}
Usage in Design
project is one of the most widely used geometry helpers in Design-Core:
Dimensions — extension lines and dimension line endpoints are computed by projecting measured points along the dimension direction by set offsets.
RotatedDimension — the dimension line direction vector is obtained by projecting a unit distance from the first definition point at the user-supplied rotation angle, then passing that direction to
perpendicular().Arc generation — arc vertices are generated by projecting the arc radius from the centre at each incremental angle step.
Distance tool — bearing and distance feedback is derived from the projected endpoint.