MCPcopy Index your code
hub / github.com/processing/p5.js / arcPrimitive

Method arcPrimitive

src/shape/custom_shapes.js:986–1019  ·  view source on GitHub ↗
(x,y,w,h,start,stop,mode)

Source from the content-addressed store, hash-verified

984
985
986 arcPrimitive(x,y,w,h,start,stop,mode){
987 this.beginShape();
988 const centerX = x+w/2;
989 const centerY = y+h/2;
990 const radiusX = w / 2;
991 const radiusY = h / 2;
992
993 const startVertex = this.#createVertex(
994 new Vector(
995 centerX + radiusX * Math.cos(start),
996 centerY + radiusY * Math.sin(start)
997 )
998 );
999
1000 const endVertex = this.#createVertex(
1001 new Vector(
1002 centerX + radiusX * Math.cos(stop),
1003 centerY + radiusY * Math.sin(stop)
1004 )
1005 );
1006
1007 const primitive = new ArcPrimitive(
1008 startVertex,
1009 endVertex,
1010 x, y, w, h,
1011 start,
1012 stop,
1013 mode
1014 );
1015 primitive.addToShape(this);
1016 this.endShape();
1017 return this;
1018
1019 }
1020
1021 ellipsePrimitive(x,y,w,h){
1022 const centerVertex = this.#createVertex(new Vector(x+w/2,y+h/2));

Callers 1

arcMethod · 0.95

Calls 4

beginShapeMethod · 0.95
#createVertexMethod · 0.95
endShapeMethod · 0.95
addToShapeMethod · 0.45

Tested by

no test coverage detected