> For the complete documentation index, see [llms.txt](https://kdoore.gitbook.io/cs1335-java-and-processing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kdoore.gitbook.io/cs1335-java-and-processing/project-1/pshape-with-cutout-inner-contour.md).

# PShape with Cutout - Inner Contour

![](https://2308964916-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgIQowgQ2sRmRGm%2F-M04eXfov2q8lvkrzSfw%2F-M04ejtnX9hh3baULqVN%2FScreen%20Shot%202018-09-04%20at%2012.22.32%20PM.png?generation=1581716826571474\&alt=media)

The image below shows how vertex points can be specified as a fractional value of len, the input parameter for our PShape functions.

The drawing shows the points that are specified in the code below. You will want to draw a similar diagram to determine points for your custom shape vertices. Notice that points used for the cutout-inner-contour are specified in counter-clockwise manner. The last point for the outershape is (0,0), it's not re-numbered in the drawing, instead, the point with label 5 has values: s.vertex(.25*len, .45*len), it is located near point 4 on the drawing.

![](https://2308964916-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgIQowgQ2sRmRGm%2F-M04eXfov2q8lvkrzSfw%2F-M04ejtpRD-2nTVBdI84%2FIMG_3079.jpg?generation=1581716826292496\&alt=media)

## PShape with Contour

The code below shows that PShape can have an inner cutout created using the beginContour(), endContour() functions. The vertex points specified within those 2 functions will be cut-out of the larger shape that was specified before the beginContour() function. The point numbers correspond to the circled numbers in drawing above.

```java
  PShape s = createShape();
  s.beginShape();
  s.fill(200, 100,100 ); //HSB - blue full sat, bright
  s.vertex( 0,0); //point 1 for outer shape (clock-wise rotation for drawing points)
  s.vertex( len*.4,0); //point  2
  s.vertex( len*.6, len*.6); //point 3
  s.vertex( 0, len*.4); //point 4
  s.vertex( 0,0); //last point for outer shape

   ////start of inner cutout - counter-clockwise ordering
  s.beginContour(); //make internal cutout 
  s.vertex( len*.25,len*.45); //inner cutouts - point 5
  s.vertex(len*.5, len*.5);  //point 6
  s.vertex( len*.45, len*.25); //point 7
  s.endContour(); //end internal cutout

  s.endShape(CLOSE); //end shape
  shape( s, 0,0);  //this displays the shape on the canvas at point (0,0)
```

## Repeat Pattern using PShape with contour

The image below shows an intricate pattern created using a recursive function and a PShape that has an inner cut-out, contour.

![](https://2308964916-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgIQowgQ2sRmRGm%2F-M04eXfov2q8lvkrzSfw%2F-M04ejtrOWjrCWLjIzW3%2FScreen%20Shot%202018-09-04%20at%2012.17.58%20PM.png?generation=1581716832296005\&alt=media)
