Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
jorditost
Twitter Link:
http://twitter.com/jorditost
jorditost's Profile
1
Posts
2
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Avoid sharp corners closing a shape with curveVertex
[1 Reply]
23-Aug-2013 02:38 AM
Forum:
Programming Questions
Hi,
I have a problem when trying to build a shape with curveVertex. All curve vertex are drawn round (as they are supposed to be) but the the vertex that closes the shape (first point after beginShape, last point before endShape) is drawn sharp.
Here's an example:
void setup() {
size(400, 400);
}
void draw() {
background(255);
fill(0);
PVector p_a = PVector.fromAngle(PI/6.0);
p_a.mult(100);
PVector p_b = PVector.fromAngle(2*PI/3.0 + PI/6.0);
p_b.mult(100);
PVector p_c = PVector.fromAngle(2*PI/3.0*2.0 + PI/6.0);
p_c.mult(100);
// Center points between axes
PVector cp_a = PVector.lerp(p_a, p_c, 0.5);
PVector cp_b = PVector.lerp(p_b, p_a, 0.5);
PVector cp_c = PVector.lerp(p_c, p_b, 0.5);
cp_a.mult(0.7);
cp_b.mult(0.7);
cp_c.mult(0.7);
//calculateSecondaryPoints(cp_a, cp_b, cp_c);
pushMatrix();
translate(width/2, height/2);
rotate(PI/2.0-PI/5.0);
fill(0);
noFill();
strokeWeight(2);
int z = 0;
beginShape();
curveVertex(p_a.x, p_a.y);
curveVertex(p_a.x, p_a.y);
curveVertex(cp_b.x, cp_b.y);
curveVertex(p_b.x, p_b.y);
curveVertex(cp_c.x, cp_c.y);
curveVertex(p_c.x, p_c.y);
curveVertex(cp_a.x, cp_a.y);
curveVertex(p_a.x, p_a.y);
curveVertex(p_a.x, p_a.y);
endShape();
popMatrix();
}
In my code I generate the shape with random vertex amplitude. I've seen
this thread
, but doesn't really work for me.
Thanks for your help!
«Prev
Next »
Moderate user : jorditost
Forum