vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
542 stars 90 forks source link

Why is there no `path operator cast(segment)` and `path operator cast(triangle)`? #323

Closed jamadagni closed 2 years ago

jamadagni commented 2 years ago
$ grep "path operator cast" geometry.asy 
path operator cast(point p)
path operator cast(ellipse el)
path operator cast(circle c)
path operator cast(parabola p)
path operator cast(hyperbola h)
path operator cast(conic co)
path operator cast(explicit arc a)
path operator cast(mass M){return M.M;}

While I understand that in the case of a line if extend is true on either side then it cannot be cast into a path, at least there can be a cast for segment?

And for triangle, there is

https://github.com/vectorgraphics/asymptote/blob/587a21490bf6d3892ddeab36dc8d8acdd3cec32c/base/geometry.asy#L5542-L5545

But this is unexpected since all other shapes in the module use cast only. And I do not understand why the order is A -- C -- B and not A -- B -- C. Surely the input order means something?

johncbowman commented 2 years ago

The order determines the orientation of the path.