Outline(OutlineComponent[] components){ |
Outline(OutlineComponent[] components){ |
this.components=components; |
this.components=components; |
} |
} |
|
Outline(OutlineComponent component){ |
|
this.components=new OutlineComponent[1]; |
|
this.components[0]=component; |
|
} |
|
Outline append(Outline outline){ |
|
OutlineComponent[] newComponents=new OutlineComponent[components.length+outline.components.length]; |
|
System.arraycopy(components,0,newComponents,0,components.length); |
|
System.arraycopy(outline.components,0,newComponents,components.length,outline.components.length); |
|
return new Outline(newComponents); |
|
} |
|
Outline plus(Point p0){ |
|
OutlineComponent[] newComponents=new OutlineComponent[components.length]; |
|
for(int i=0;i<components.length;i++){ |
|
newComponents[i]=components[i].plus(p0); |
|
} |
|
return new Outline(newComponents); |
|
} |
|
Outline rot(double theta){ |
|
OutlineComponent[] newComponents=new OutlineComponent[components.length]; |
|
for(int i=0;i<components.length;i++){ |
|
newComponents[i]=components[i].rot(theta); |
|
} |
|
return new Outline(newComponents); |
|
} |
|
Outline times(double ratio){ |
|
OutlineComponent[] newComponents=new OutlineComponent[components.length]; |
|
for(int i=0;i<components.length;i++){ |
|
newComponents[i]=components[i].times(ratio); |
|
} |
|
return new Outline(newComponents); |
|
} |
|
Outline timesY(double ratio){ |
|
OutlineComponent[] newComponents=new OutlineComponent[components.length]; |
|
for(int i=0;i<components.length;i++){ |
|
newComponents[i]=components[i].timesY(ratio); |
|
} |
|
return new Outline(newComponents); |
|
} |
|
Point firstPoint(){ |
|
return components[0].firstPoint(); |
|
} |
|
Point lastPoint(){ |
|
return components[components.length-1].lastPoint(); |
|
} |
OutlineComponent[] getComponents(){ return components; } |
OutlineComponent[] getComponents(){ return components; } |
|
public String toString(){ |
|
String str="Outline("; |
|
for(int i=0;i<components.length;i++) |
|
str+=components[i].toString(); |
|
return str+")"; |
|
} |
} |
} |