Revision: 1.2 - (view) (download) (as text)
1 : | ktanaka | 1.1 | import java.util.*; |
2 : | public class Line extends OutlineComponent{ | ||
3 : | Point p0,p1; | ||
4 : | Line(Point p0,Point p1){ | ||
5 : | this.p0=p0; this.p1=p1; | ||
6 : | } | ||
7 : | public void render(Vector ret,double limit){ | ||
8 : | ret.addElement(p0); | ||
9 : | ret.addElement(p1); | ||
10 : | } | ||
11 : | ktanaka | 1.2 | public OutlineComponent plus(Point point){ |
12 : | return new Line(p0.plus(point),p1.plus(point)); | ||
13 : | } | ||
14 : | public OutlineComponent rot(double theta){ | ||
15 : | return new Line(p0.rot(theta),p1.rot(theta)); | ||
16 : | } | ||
17 : | public OutlineComponent times(double ratio){ | ||
18 : | return new Line(p0.times(ratio),p1.times(ratio)); | ||
19 : | } | ||
20 : | public OutlineComponent timesY(double ratio){ | ||
21 : | return new Line(p0.timesY(ratio),p1.timesY(ratio)); | ||
22 : | } | ||
23 : | public Point firstPoint(){ return p0;} | ||
24 : | public Point lastPoint(){ return p1;} | ||
25 : | public String toString(){ | ||
26 : | return "Line("+p0+","+p1+")"; | ||
27 : | } | ||
28 : | ktanaka | 1.1 | } |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |