logo

TrackStars_3D_Path

class Path {

  ArrayList<PVector> points;
  float radius = 20;
  boolean dim;

  Path() {
    this.points = new ArrayList<PVector>();
  }
  void addPoint(float x, float y, float z) {   
    PVector point = new PVector(x, y, z);
    this.points.add(point);
  }
  //-------------------------------------------------------------------------------------
  // Draw the path
  void display() {
    
    // Draw thick line for radius
    stroke(120,120,120,50);
    strokeWeight(radius*2);
    noFill();
    beginShape();
    for (PVector v : points) {
      vertex(v.x, v.y, v.z);
    }
    endShape();
    
    // Draw thin line for center of path
    stroke(255);
    strokeWeight(1);
    noFill();
    beginShape();
    for (PVector v : points) {
      vertex(v.x, v.y, v.z);
    }
    endShape();
  }
}
  • Share