From: mathog <ma...@ca...> - 2012-09-05 18:18:44
|
On 02-Sep-2012 15:03, Krzysztof Kosiński wrote: > 2012/8/31 mathog <ma...@ca...>: >> 1. generate a second PathVector "pathB". In one case this is a >> rectangle (with corners known), and in the the other it is an >> elliptical >> ring (center, inner/outer radii, minor, major unit axis vectors all >> known). > > If your rectangle has corners at points a, b, c, d, do the following: > > Geom::Point > Geom::Path x(a); > x.appendNew<Geom::LineSegment>(b); > x.appendNew<Geom::LineSegment>(c); > x.appendNew<Geom::LineSegment>(d); > x.close(); This one works. > > For an elliptical ring, do the same, but use two > Geom::SVGEllipticalArc. The constructors are the same as for > Geom::EllipticalArc and are documented with Doxygen comments. > The elliptical path is giving me conniptions. This is what is seen when the "cutter" is viewed (sorry about any line wraps): Geom::Path cutter; cutter.start(Geom::Point(250, 1000) ); // just the point // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI, Geom::Point(250, 1000) ); // long skinny ellipse at 1:30 on clock // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI, Geom::Point(250.1, 1000) ); // ditto // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI, Geom::Point(251.0, 1000) ); // ditto // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI, Geom::Point(270.0, 1000) ); // ditto // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI/4.0, Geom::Point(270.0, 1000) ); // long skinny elipse at 7:30 on clock // cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, 0.0, Geom::Point(270.0, 1000) ); I didn't pick these numbers arbitrarily, they were derived using the svg-elliptical-arc-test-toy test program. From that I expected the first one to be a 1000 tall, 100 wide ellipse with its lowest point at 250,1000. Here are the bezier points (not the control points) for this form cutter.appendNew<Geom::SVGEllipticalArc>( 50.0, 500.0, true, true, M_PI/4.0, Geom::Point(270.0, 1000) ); as seen when they hit the "stroke" part of my driver: 244.204 996.223 276.971 953.438 365.389 878.694 496.893 782.607 652.798 678.83 810.968 582.097 948.966 506.129 1047.23 461.692 1091.83 455.077 1076.46 487.222 1003.26 553.574 882.61 644.735 680.347 782.252 425.566 931.384 313.999 985.863 If you plot them in Excel or gnuplot you can see the sort of ellipse that is coming out. Long and skinny, but the wrong angle. Is there maybe a function in 2geom to convert from ellipse(center, long radius, short radius, rotation angle) to this other path specification system? Thanks, David Mathog ma...@ca... Manager, Sequence Analysis Facility, Biology Division, Caltech |