FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Suggestions
   Software Suggestions
(Moderator: fry)
   B-Splines
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: B-Splines  (Read 899 times)
skloopy

WWW
B-Splines
« on: Aug 28th, 2003, 3:18am »

Hi this is something I posted about earlier, but i thought i'd make it formal.
 
Could P5's beginShape(LINE_STRIP) and bezierVertex() allow for more than 4 vertices? Also it would be cool if P5 would close the curve when you use LINE_LOOP
 
Sort of like this example http://www.cse.unsw.edu.au/~lambert/splines/natcubicclosed.html for curveVertex(). I don't have an example for bezier, but it's the same thing except the curve doesn't touch the control points.
 
Edit: Would it be confusing with beziers and bsplines being used in the same way, or could they draw the same way?
« Last Edit: Aug 28th, 2003, 3:21am by skloopy »  
arielm

WWW
Re: B-Splines
« Reply #1 on: Aug 28th, 2003, 2:05pm »

scloopy, can you please tell me what P5 version you are using, related to the "more than 4 control points" issue for bezier curves (i think it was supposed to be fixed with version 057)
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: B-Splines
« Reply #2 on: Aug 28th, 2003, 5:27pm »

you can get this functionality using bezierVertex() for sure. the problem before was just that bezierVertex, prior to rev 57 was broken for > 4 control points.  
 
now you should be able to implement a shape like this w/ no problem.
 
skloopy

WWW
Re: B-Splines
« Reply #3 on: Aug 28th, 2003, 7:52pm »

Hmm I'm using Processing 58 on OS X. Curves work all right, but not beziers. Maybe i'm doing something wrong? I exported the sketch i'm working on so you can see.. I hilited the drawing code, cuz the sketch is a little big.
 
http://elfman.vendetta.com/ryan/typeBubble/
 
Thanks for the help!
 
ryan
 
Edit: Oops I forgot, you have to focus the sketch and then just type a lot of lines to see where the problem comes in.
« Last Edit: Aug 28th, 2003, 8:13pm by skloopy »  
arielm

WWW
Re: B-Splines
« Reply #4 on: Aug 28th, 2003, 11:03pm »

hmm hmm...
 
as a minimal test-case:
Code:

beginShape(LINE_STRIP);
bezierVertex(30, 20);
bezierVertex(80, 0);
bezierVertex(80, 75);  
bezierVertex(30, 75);
bezierVertex(10, 50);  // 5th one: NOT WORKING !!!
endShape();

 
all this, in 058... is it normal fry?
 
 
p.s: ryan, nice typewriter! (+ i was thinking of an worlwide virtual typewriter programming contest for one these days)
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: B-Splines
« Reply #5 on: Aug 29th, 2003, 5:36am »

that gives you a curve and an extra control point hanging off the end. i'm a little sleepy but i think i last fixed it such that every 4th call will do another piece of curve segment. if you want it continuous, the 4th and fifth point should be the same.  
 
think about how bezier curve 'handles' work in drawing apps like illustrator.. each segment has its two endpoints and the two little handles that are used to scoot it around. the handles are the control points (2nd and 3rd calls to bezierVertex) and the start/stop points are the 1st and 4th calls to bezierVertex.
 
skloopy

WWW
Re: B-Splines
« Reply #6 on: Aug 29th, 2003, 7:22pm »

Yeah, I understand how beziers work now
 
I guess i was just hoping that they would work more like b-splines in 3d software like Maya, where the first and last points touch the curve and you can have an unlimited amount of control points in the center that don't touch..
 
Thanks anyways fry! BTW Do you maybe know a good resource for how to program b-splines that you could point me to?
 
fry


WWW
Re: B-Splines
« Reply #7 on: Aug 29th, 2003, 8:30pm »

on Aug 29th, 2003, 7:22pm, scloopy wrote:
I guess i was just hoping that they would work more like b-splines in 3d software like Maya, where the first and last points touch the curve and you can have an unlimited amount of control points in the center that don't touch..

ah, i see.. actually, i think maya is just faking it, since you can subdivide a curve to add more control points by interpolating the on/off curve points, etc.. (though i don't have a reference for how this works offhand) so even if you were using your own bsplines, you'd have the same trouble when programming them yourself, since you'd have to keep track of those extra control points and how they're used in relation to breaking up others.  
 
on Aug 29th, 2003, 7:22pm, scloopy wrote:
BTW Do you maybe know a good resource for how to program b-splines that you could point me to

many moons ago (1996) some of my earliest curve learning came from this applet:  
http://www.geocities.com/msheinrichs/curve.html
which also includes code for how to implement bspline curves.
« Last Edit: Aug 29th, 2003, 8:32pm by fry »  
Pages: 1 

« Previous topic | Next topic »