|
Class: Curve
Object
|
+--Geometric
|
+--Curve
- Package:
- stx:libbasic2
- Category:
- Graphics-Geometry-Objects
- Version:
- rev:
1.8
date: 2009/06/06 10:12:21
- user: cg
- file: Curve.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Gittinger
A Curve is a conic section determined by three points
that interpolates the first and the third and is tangent to the angle formed
by the three points at the first and third points.
Rectangle
Polygon
EllipticalArc
Circle
Spline
Point
LineSegment
ArrowedSpline
Arrow
GraphicsContext
StrokingWrapper
FillingWrapper
instance creation
-
from: startPoint to: endPoint through: middlePoint
-
return a new curve, passing through the three given points
-
start: startPoint middle: middlePoint end: endPoint
-
return a new curve, passing through the three given points
-
with: startPoint with: middlePoint with: endPoint
-
return a new curve, passing through the three given points
accessing
-
end
-
return the endPoint
-
start
-
return the startPoint
-
start: p1 middle: p2 end: p3
-
set the startPoint, middlePoint and the endPoint
converting
-
asPointArray
-
return an array containing my points.
-
asPolygon
-
return a polygon, approximating the spline
displaying
-
displayFilledOn: aGC
-
draw the receiver as a filled curve in a graphicsContext, aGC
-
displayStrokedOn: aGC
-
draw the receiver as a unfilled curve in a graphicsContext, aGC
helpers
-
computeLineSegments
-
compute the lines which approxiamte this curve
queries
-
bounds
-
return the smallest enclosing rectangle
usage example(s):
(Curve from:10@10 to:50@100 through:50@50) bounds
(Curve from:10@10 to:50@100 through:100@50) bounds
|
testing
-
canBeFilled
-
return true, if the receiver can be drawn as a filled geometric.
Always true here.
filled & unfilled:
|v c|
v := (View extent:100@100) openAndWait.
c := Curve start:(20@20) middle:(80@80) end:(20@80).
v paint:Color blue.
c displayFilledOn:v.
v paint:Color red.
c displayStrokedOn:v.
|
with a grid (for demonstration):
|v c|
v := (View extent:200@100) openAndWait.
v lineStyle:#dashed.
v displayLineFrom:(20@0) to:(20@200).
v displayLineFrom:(180@0) to:(180@200).
v displayLineFrom:(0@20) to:(200@20).
v displayLineFrom:(0@80) to:(200@80).
v lineStyle:#solid.
c := Curve start:(20@20) middle:(180@80) end:(20@80).
v paint:Color blue.
c displayFilledOn:v.
v paint:Color red.
c displayStrokedOn:v.
v paint:(Color black).
v displayLineFrom:(20@20) to:(180@80).
v displayLineFrom:(20@80) to:(180@80).
|
|