晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /usr/share/doc/cairo/ |
Upload File : |
Here's an effort to document some of the academic work that was
referenced during the implementation of cairo. It is presented in the
context of operations as they would be performed by either
cairo_stroke() or cairo_fill():
Given a Bézier path, approximate it with line segments:
The deCasteljau algorithm
"Outillages methodes calcul", P de Casteljau, technical
report, - Andre Citroen Automobiles SA, Paris, 1959
That technical report might be "hard" to find, but fortunately
this algorithm will be described in any reasonable textbook on
computational geometry. Two that have been recommended by
cairo contributors are:
"Computational Geometry, Algorithms and Applications", M. de
Berg, M. van Kreveld, M. Overmars, M. Schwarzkopf;
Springer-Verlag, ISBN: 3-540-65620-0.
"Computational Geometry in C (Second Edition)", Joseph
O'Rourke, Cambridge University Press, ISBN 0521640105.
Then, if stroking, construct a polygonal representation of the pen
approximating a circle (if filling skip three steps):
"Good approximation of circles by curvature-continuous Bezier
curves", Tor Dokken and Morten Daehlen, Computer Aided
Geometric Design 8 (1990) 22-41.
Add points to that pen based on the initial/final path faces and take
the convex hull:
Convex hull algorithm
[Again, see your favorite computational geometry
textbook. Should cite the name of the algorithm cairo uses
here, if it has a name.]
Now, "convolve" the "tracing" of the pen with the tracing of the path:
"A Kinetic Framework for Computational Geometry", Leonidas
J. Guibas, Lyle Ramshaw, and Jorge Stolfi, Proceedings of the
24th IEEE Annual Symposium on Foundations of Computer Science
(FOCS), November 1983, 100-111.
The result of the convolution is a polygon that must be filled. A fill
operations begins here. We use a very conventional Bentley-Ottmann
pass for computing the intersections, informed by some hints on robust
implementation courtesy of John Hobby:
John D. Hobby, Practical Segment Intersection with Finite
Precision Output, Computation Geometry Theory and
Applications, 13(4), 1999.
http://cm.bell-labs.com/who/hobby/93_2-27.pdf
Hobby's primary contribution in that paper is his "tolerance square"
algorithm for robustness against edges being "bent" due to restricting
intersection coordinates to the grid available by finite-precision
arithmetic. This is one algorithm we have not implemented yet.
We use a data-structure called Skiplists in the our implementation
of Bentley-Ottmann:
W. Pugh, Skip Lists: a Probabilistic Alternative to Balanced Trees,
Communications of the ACM, vol. 33, no. 6, pp.668-676, 1990.
http://citeseer.ist.psu.edu/pugh90skip.html
The random number generator used in our skip list implementation is a
very small generator by Hars and Petruska. The generator is based on
an invertable function on Z_{2^32} with full period and is described
in
Hars L. and Petruska G.,
``Pseudorandom Recursions: Small and Fast Pseurodandom
Number Generators for Embedded Applications'',
Hindawi Publishing Corporation
EURASIP Journal on Embedded Systems
Volume 2007, Article ID 98417, 13 pages
doi:10.1155/2007/98417
http://www.hindawi.com/getarticle.aspx?doi=10.1155/2007/98417&e=cta
From the result of the intersection-finding pass, we are currently
computing a tessellation of trapezoids, (the exact manner is
undergoing some work right now with some important speedup), but we
may want to rasterize directly from those edges at some point.
Given the set of tessellated trapezoids, we currently execute a
straightforward, (and slow), point-sampled rasterization, (and
currently with a near-pessimal regular 15x17 grid).
We've now computed a mask which gets fed along with the source and
destination into cairo's fundamental rendering equation. The most
basic form of this equation is:
destination = (source IN mask) OP destination
with the restriction that no part of the destination outside the
current clip region is affected. In this equation, IN refers to the
Porter-Duff "in" operation, while OP refers to a any user-selected
Porter-Duff operator:
T. Porter & T. Duff, Compositing Digital Images Computer
Graphics Volume 18, Number 3 July 1984 pp 253-259
http://keithp.com/~keithp/porterduff/p253-porter.pdf