Skip to content

Can you add Vector.to2D? #44

@hikikomori82

Description

@hikikomori82

I'm working in 2D only but Line.pointClosestTo returns 3D vector with z being 0, can you add Vector.to2D() function that would drop third element of a vector, right now there is Vector.to3D which adds zero, this would remove it. It is problem because when I want to use it later:

Vector.create([2, 0]).subtract(Vector.create([1, 0, 0])) - returns null

In order to make it work I need to use temp variable:
var t = Vector.create([1, 0, 0]);
t = Vector.create([t[0], t[1]]);
Vector.create([2, 0]).subtract(t);

Which is unwieldy but more importantly cannot be chained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions