thanks that's helpful. the bit about having access to the original vertices and not the 20 new ones was clear from your first post. my bad on not getting that and providing a useless answer. still, thanks for taking the time to re-explain. maybe helpful for others.
your comment about what you wish to do when you have the bezier verts (make it bigger w/o scale) was helpful in answering my question whether or not the number of vertices will stay the same. It sounds like they will stay the same and if that is so, then the idea i have is to use either an array or even better, a class.
create a Heart class that takes an array of bezier coordinates when it's created and stores them as an array called bezierVertices (or bezVerts, etc) as one of it's properties. then you could create your own class function called getBezVertices() and have access to them that way. Here's an untested example of what i'm talking about, I've never used PShapes so that part of the code may be extra incorrect.
- class Heart {
- float[][] bezierVertices;
- PShape shape;
- Heart(float[][] bezVs) {
- bezierVerticies = bezVs;
- shape = createShape();
- }
- void display(){
- //all the yummy goodness you already wrote to display the heart
- }
- float[][] getBezierVertices(){
- return this.bezierVerticies;
- }
- float[] getBezierVertex(int i){
- return this.bezierVerticies[i];
- }
- void setBezierVertex(int i, float nx, float ny){
- this.bezierVertices[i][0] = nx;
- this.bezierVertices[i][1] = ny;
- }
or, if you had a 2D heartBezVertices array which had the coordinates of the vertices, then you could change the values in the elements of the array and multiply them by a scale factor. however, i'm not sure this would be much more efficient than just adding a scale factor to your current code. here's an example, scale factor not included because i imagine that in some cases it has to be pos and others neg.
- //float b/c you have fractions
- float[][] heartBezVerts = { {heartSize/2, heartSize*0.15},
- {heartSize*0.5, -heartSize*0.05},
- {heartSize*0.9, heartSize*0.05},
- {heartSize*0.5, heartSize*0.4},
- {heartSize/2, heartSize*0.15},
- {heartSize*0.5, -heartSize*0.05},
- {heartSize*0.1, heartSize*0.05},
- {heartSize*0.5, heartSize*0.4} }
- myShape = createShape();
- myShape.beginShape();
- myShape.vertex (heartBezVerts[0][0], heartBezVerts[0][1]);
- myShape.bezierVertex(heartBezVerts[1][0], heartBezVerts[1][1],
- heartBezVerts[2][0], heartBezVerts[2][1],
- heartBezVerts[3][0], heartBezVerts[3][1]);
- myShape.vertex(heartBezVerts[4][0] * s, heartBezVerts[4][1] * s);
- myShape.bezierVertex(heartBezVerts[5][0], heartBezVerts[5][1],
- heartBezVerts[6][0], heartBezVerts[6][1],
- heaheartBezVerts[7][0], heartBezVerts[7][1]);
- myShape.endShape();