[BUG][FIX] Bezier3Segment divide-by-zero

Duane Maxwell dmaxwell at entrypoint.com
Fri Mar 10 20:17:41 UTC 2000


'From Squeak2.7 of 5 January 2000 [latest update: #1782] on 10 March 2000
at 12:15:07 pm'!
"Change Set:		Bezier3SegmentFix
Date:			10 March 2000
Author:			Duane Maxwell

Fixes bug in computation of number of quadratic bezier segments to
approximate a cubic bezier curve for certain straight lines crossing the y
axis."
!


!Bezier3Segment methodsFor: 'converting' stamp: 'DSM 3/10/2000 12:10'!
bezier2SegmentCount: pixelError
	"Compute the number of quadratic bezier segments needed to approximate
	this cubic with no more than a specified error"
	| a |
	a _ (start x negated @ start y negated) + (3 * via1) - (3 * via2) +
(end).
	^ (((a r / (20.0 * pixelError)) raisedTo: 0.333333) ceiling) max: 1.

! !







More information about the Squeak-dev mailing list