[Commit] cairo ChangeLog, 1.65, 1.66 TODO, 1.6, 1.7 configure.in,
1.18, 1.19
Carl Worth
commit at keithp.com
Mon Sep 29 09:36:32 PDT 2003
- Previous message: [Commit] cairo-demo/X11 cairo-knockout.c,1.5,1.6
- Next message: [Commit] cairo/src cairo.c, 1.14, 1.15 cairo.h, 1.15,
1.16 cairo_font.c, 1.6, 1.7 cairo_gstate.c, 1.14,
1.15 cairoint.h, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: cworth
Update of /local/src/CVS/cairo
In directory home.keithp.com:/tmp/cvs-serv7386
Modified Files:
ChangeLog TODO configure.in
Log Message:
Added cairo_arc and cairo_arc_negative.
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/cairo/ChangeLog,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- ChangeLog 27 Sep 2003 12:08:38 -0000 1.65
+++ ChangeLog 29 Sep 2003 15:36:29 -0000 1.66
@@ -1,4 +1,23 @@
-2003-09-27 Carl Worth <cworth at isi.edu>
+2003-09-29 Carl Worth <cworth at isi.edu>
+
+ * configure.in (CAIRO_VERSION): Bumpred version to 0.1.6 to
+ indicate new cairo_arc and cairo_arc_negative.
+
+ * src/cairo_gstate.c (_arc_error_normalized):
+ (_arc_max_angle_for_tolerance_normalized):
+ (_cairo_gstate_arc_segments_needed):
+ (_cairo_gstate_arc_segment):
+ (_cairo_gstate_arc_dir):
+ (_cairo_gstate_arc):
+ (_cairo_gstate_arc_negative): Several new functions to implement
+ arc support.
+
+ * src/cairo.h: Added cairo_arc and cairo_arc_negative.
+
+ * src/cairo.c (cairo_arc):
+ (cairo_arc_negative): Added new arc support.
+
+2003-09-27 Carl Worth <cworth at isi.edu>
* src/cairoint.h: Fixed several enum symbols that had been
mistakenly converted to lowercase at some point.
Index: TODO
===================================================================
RCS file: /local/src/CVS/cairo/TODO,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TODO 17 Sep 2003 15:48:41 -0000 1.6
+++ TODO 29 Sep 2003 15:36:29 -0000 1.7
@@ -11,12 +11,13 @@
* Verification, profiling, optimization.
-
Some notes on arc support
--------------------------
+=========================
-"Approximation of circular arcs by cubic poynomials", Michael Goldapp,
-Computer Aided Geometric Design 8 (1991) 227-238.
+Some general notions
+--------------------
+This is from "Approximation of circular arcs by cubic poynomials",
+Michael Goldapp, Computer Aided Geometric Design 8 (1991) 227-238.
To draw a unit arc from 0 to A with 0 < A < pi/2:
@@ -37,9 +38,14 @@
e(t) = x^2(t) + y^2(t) - 1
-And from Dokken[cite]: e(t) ~ 2 abs( rho(t) )
+And from "Good approximation of circles by curvature-continuous Bezier
+curves", Tor Dokken and Morten Daehlen, Computer Aided Geometric
+Design 8 (1990) 22-41, we learn:
-A single cubic Bezier spline approximation must have the 4 control points:
+ e(t) ~ 2 abs( rho(t) )
+
+Continuing with Goldapp's analysis, a single cubic Bezier spline
+approximation must have the 4 control points:
(1, 0)
(1, h)
@@ -55,7 +61,38 @@
abs( max(e(t)) ) = 4/27 * (sin^6 (A/4)) / (cos^2 (A/4))
t in [0,1]
-
+
+-----
+
+Now, for Cairo we want to draw an arc of radius R from an angle A to
+an angle B, (where B > A). So the equations above have trivial
+modifications:
+
+The spline control points become
+
+ (R * cos(A), R * sin(A))
+ (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A))
+ (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B))
+ (R * cos(B), R * sin(B))
+
+where h = 4/3 * R * tan ((B-A)/4)
+
+And the maximum deviation in radius is approximately:
+
+ 2/27 * (sin^6 ((B-A)/4) / cos^2 ((B-A)/4))
+
+So now we can get down to writing some C code:
+
+double
+_arc_error_normalized (double angle)
+{
+ return 2/27 * pow (sin (angle / 4), 6) / pow (cos (angle / 4), 2);
+}
+
+And for accurate drawing the following must hold in device space:
+
+ tolerance/radius >= _arc_error_normalized (B-A)
+
A comparison with PostScript
============================
@@ -190,4 +227,3 @@
Type,Attribute,and Conversion Operators, File Operators, Resource
Operators, Virtual Memory Operators, Miscellaneous Operators,
Interpreter Parameter Operators, Errors
-
Index: configure.in
===================================================================
RCS file: /local/src/CVS/cairo/configure.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- configure.in 25 Sep 2003 22:01:28 -0000 1.18
+++ configure.in 29 Sep 2003 15:36:29 -0000 1.19
@@ -3,7 +3,7 @@
dnl ===========================================================================
# Package version number, (as distinct from shared library version)
-CAIRO_VERSION=0.1.5
+CAIRO_VERSION=0.1.6
# libtool shared library version
- Previous message: [Commit] cairo-demo/X11 cairo-knockout.c,1.5,1.6
- Next message: [Commit] cairo/src cairo.c, 1.14, 1.15 cairo.h, 1.15,
1.16 cairo_font.c, 1.6, 1.7 cairo_gstate.c, 1.14,
1.15 cairoint.h, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list