1303
|
1 |
"{ Package: 'stx:libbasic2' }"
|
|
2 |
|
763
|
3 |
LineSegment subclass:#Bezier2Segment
|
|
4 |
instanceVariableNames:'via'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
1303
|
7 |
category:'Graphics-Geometry-Objects'
|
763
|
8 |
!
|
|
9 |
|
765
|
10 |
!Bezier2Segment class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
borrowed from Squeak2.4
|
|
15 |
|
|
16 |
This class represents a quadratic bezier segment between two points
|
|
17 |
|
|
18 |
Instance variables:
|
|
19 |
via <Point> The additional control point (OFF the curve)
|
|
20 |
"
|
|
21 |
! !
|
763
|
22 |
|
|
23 |
!Bezier2Segment class methodsFor:'instance creation'!
|
|
24 |
|
|
25 |
from:startPoint via:viaPoint to:endPoint
|
|
26 |
^ self new from:startPoint to:endPoint via:viaPoint
|
|
27 |
|
|
28 |
! !
|
|
29 |
|
|
30 |
!Bezier2Segment methodsFor:'accessing'!
|
|
31 |
|
|
32 |
via
|
|
33 |
"Return the control point"
|
|
34 |
^ via
|
|
35 |
|
|
36 |
! !
|
|
37 |
|
|
38 |
!Bezier2Segment methodsFor:'initialization'!
|
|
39 |
|
|
40 |
from:start to:end
|
|
41 |
"Initialize the receiver as straight line"
|
|
42 |
|
|
43 |
startPoint := start.
|
|
44 |
endPoint := end.
|
|
45 |
via := (start + end) // 2.
|
|
46 |
|
|
47 |
!
|
|
48 |
|
|
49 |
from:start to:end via:viaPoint
|
|
50 |
"Initialize the receiver"
|
|
51 |
|
|
52 |
startPoint := start.
|
|
53 |
endPoint := end.
|
|
54 |
via := viaPoint.
|
|
55 |
! !
|
|
56 |
|
|
57 |
!Bezier2Segment methodsFor:'testing'!
|
|
58 |
|
|
59 |
isBezier2Segment
|
|
60 |
"return true, if the receiver is a quadratic bezier segment"
|
|
61 |
|
|
62 |
^ true
|
|
63 |
|
|
64 |
|
|
65 |
! !
|
|
66 |
|
|
67 |
!Bezier2Segment class methodsFor:'documentation'!
|
|
68 |
|
|
69 |
version
|
1303
|
70 |
^ '$Header: /cvs/stx/stx/libbasic2/Bezier2Segment.st,v 1.3 2003-08-29 17:32:22 cg Exp $'
|
763
|
71 |
! !
|