|
Class: Curve
Object
|
+--Geometric
|
+--Curve
- Package:
- stx:libbasic2
- Category:
- Graphics-Geometry-Objects
- Version:
- rev:
1.12
date: 2022/02/17 10:25:29
- user: cg
- file: Curve.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
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.
copyrightCOPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
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
-
computeBounds
-
return the smallest enclosing rectangle
testing
-
canBeFilled
-
return true, if the receiver can be drawn as a filled geometric.
Always true here.
filled & unfilled:
|v c|
v := (View extent:200@200) openAndWaitUntilVisible.
v transformation:(WindowingTransformation
scale:1
translation:(100@100)).
v paint:Color black.
v displayLineFrom:(-90@0) to:(90@0).
v displayLineFrom:(0@-90) to:(0@90).
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.
|
|v c|
v := (View extent:200@200) openAndWaitUntilVisible.
v transformation:(WindowingTransformation
scale:1
translation:(100@100)).
v paint:Color black.
v displayLineFrom:(-90@0) to:(90@0).
v displayLineFrom:(0@-90) to:(0@90).
c := Curve start:(0@20) middle:(40@60) end:(0@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) openAndWaitUntilVisible.
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).
|
|