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

Additions to geometry.asy #327

Closed jamadagni closed 2 years ago

jamadagni commented 2 years ago

These commits hope to address #321, #323, #324. I was not able to figure out the part about filling a parabola or hyperbola within the bounding box.

Code to test the new features:

import geometry;
triangle t = triangle((1, 1), (2, -3), (4, 5));
point o = orthocenter(t);
path p1 = (path)t;
segment s = segment((1, 1), (2, -3));
path p2 = (path)s;
fill    (circle((1, 10), 1), lightgreen);
filldraw(circle((3, 10), 1), yellow, blue);
fill    (ellipse((5, 20), (10, 20), 5), lightred);
filldraw(ellipse((-5, 20), (-10, 20), 4), cyan, magenta);
fill    (t, lightblue);
filldraw(xscale(-1) * t, lightmagenta, green);
triangle y = shift(0, -10) * yscale(-1) * t;
fill(new triangle [] {y, rotate(20) * y, rotate(40) * y}, red);
filldraw(new triangle [] {rotate(60) * y, rotate(80) * y}, orange, brown);
jamadagni commented 2 years ago

Hmm looks like path operator cast(segment) should be changed to ecast else it causes conflicts of intersectionpoint(segment, segment) with intersectionpoint(path, path)?