class Polygons – the code

class Polygons{
  Polygon[] polygons;
  
  Polygons(){
    polygons=new Polygon[0];
  }
      
  void addPolygon(Polygon p){
    polygons=(Polygon[])(append(polygons,p));
  }
  
  void show(){
    for (int i=0;i<polygons.length;i++){
      polygons[i].show();
    }
  }

  void showRegular(int nCorners){ // polynoms with nCorners
    for (int i=0;i<polygons.length;i++){
      polygons[i].showRegular(nCorners);
    }
  }

  void showRhomb(float angle){ //rhombs with given angle
    float cosAngle=cos(angle);
    println(cosAngle);
    for (int i=0;i<polygons.length;i++){
      polygons[i].showRhomb(cosAngle);
    }
  }

  void createDualPoints(Points dualPoints,Lines dualLines){
    for (int i=0;i<polygons.length;i++){
      polygons[i].createDualPoint(dualPoints,dualLines);
    }
  }
}
This entry was posted in programming and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s