Project ======= **Method:** ``point.project(angle, distance)`` **Parameters:** - ``angle`` — bearing direction in **radians** (measured counter-clockwise from the positive :math:`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 :math:`P`, the new point :math:`P'` is: .. math:: P'_x = P_x + d\cos\theta .. math:: P'_y = P_y + d\sin\theta where :math:`d` is the distance and :math:`\theta` is the angle in radians. This is equivalent to expressing the displacement in polar coordinates :math:`(d,\,\theta)` and adding it to the Cartesian position of :math:`P`. Angle reference ~~~~~~~~~~~~~~~ Angles follow the standard mathematical convention: :math:`0` points along the positive :math:`x`-axis (east), increasing counter-clockwise. +---------+-----------------------------------------------------------------+ | Angle | Direction | +=========+=================================================================+ | 0 | East (positive :math:`x`) | +---------+-----------------------------------------------------------------+ | π / 2 | North (positive :math:`y`) | +---------+-----------------------------------------------------------------+ | π | West (negative :math:`x`) | +---------+-----------------------------------------------------------------+ | 3π / 2 | South (negative :math:`y`) | +---------+-----------------------------------------------------------------+ Implementation -------------- .. code-block:: javascript 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. See Also -------- :doc:`perpendicular` | :doc:`rotate` | :doc:`../development`