コード例 #1
0
 private void drawUsingPolygons(TherapeuticPresence _mainApplet) {
   _mainApplet.fill(color, transparency);
   _mainApplet.noStroke();
   _mainApplet.beginShape(PConstants.POLYGON);
   for (int i = 0; i < anchorPointsCounter - 1; i++) {
     if (i == 0) {
       _mainApplet.vertex(
           anchorPoints[i].x, anchorPoints[i].y - strokeWeight, anchorPoints[i].z - zOffset);
     }
     _mainApplet.bezierVertex(
         controlPoints[i].x,
         controlPoints[i].y - strokeWeight,
         controlPoints[i].z - zOffset,
         controlPoints[i].x,
         controlPoints[i].y - strokeWeight,
         controlPoints[i].z - zOffset,
         anchorPoints[i + 1].x,
         anchorPoints[i + 1].y - strokeWeight,
         anchorPoints[i + 1].z - zOffset);
   }
   for (int i = anchorPointsCounter - 2; i >= 0; i--) {
     if (i == anchorPointsCounter - 2) {
       _mainApplet.vertex(
           anchorPoints[i + 1].x,
           anchorPoints[i + 1].y + strokeWeight,
           anchorPoints[i + 1].z - zOffset);
     }
     _mainApplet.bezierVertex(
         controlPoints[i].x,
         controlPoints[i].y + strokeWeight,
         controlPoints[i].z - zOffset,
         controlPoints[i].x,
         controlPoints[i].y + strokeWeight,
         controlPoints[i].z - zOffset,
         anchorPoints[i].x,
         anchorPoints[i].y + strokeWeight,
         anchorPoints[i].z - zOffset);
   }
   _mainApplet.endShape(PConstants.CLOSE);
 }
コード例 #2
0
 private void drawUsingStrokeWeight(TherapeuticPresence _mainApplet) {
   _mainApplet.stroke(color, transparency);
   _mainApplet.noFill();
   _mainApplet.strokeWeight(strokeWeight);
   _mainApplet.beginShape();
   for (int i = 0; i < anchorPointsCounter - 1; i++) {
     if (i == 0) {
       _mainApplet.vertex(anchorPoints[i].x, anchorPoints[i].y, anchorPoints[i].z - zOffset);
     }
     _mainApplet.bezierVertex(
         controlPoints[i].x,
         controlPoints[i].y,
         controlPoints[i].z - zOffset,
         controlPoints[i].x,
         controlPoints[i].y,
         controlPoints[i].z - zOffset,
         anchorPoints[i + 1].x,
         anchorPoints[i + 1].y,
         anchorPoints[i + 1].z - zOffset);
   }
   _mainApplet.endShape();
 }
コード例 #3
0
 private void drawUsingStrokeOffset(TherapeuticPresence _mainApplet) {
   _mainApplet.stroke(color, transparency);
   _mainApplet.noFill();
   for (float j = -strokeOffset; j <= strokeOffset; j += strokeOffset) {
     _mainApplet.beginShape();
     for (int i = 0; i < anchorPointsCounter - 1; i++) {
       if (i == 0)
         _mainApplet.vertex(anchorPoints[i].x, anchorPoints[i].y + j, anchorPoints[i].z - zOffset);
       _mainApplet.bezierVertex(
           controlPoints[i].x,
           controlPoints[i].y + j,
           controlPoints[i].z - zOffset,
           controlPoints[i].x,
           controlPoints[i].y + j,
           controlPoints[i].z - zOffset,
           anchorPoints[i + 1].x,
           anchorPoints[i + 1].y + j,
           anchorPoints[i + 1].z - zOffset);
     }
     _mainApplet.endShape();
     if (strokeOffset == 0) break;
   }
 }