Skip to content

atan versus atan2 #166

@SheetJSDev

Description

@SheetJSDev

Both dashed and zigzag use Math.atan:

      const alpha = Math.atan((p2[1] - p1[1]) / (p2[0] - p1[0]));

It would seem that a generated vertical line would cause errors. Is there a reason for preferring this over the safer atan2 alternative?

      const alpha = Math.atan2((p2[1] - p1[1]), (p2[0] - p1[0]));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions