Need help creating parabola
nmz787 opened this issue · 1 comments
nmz787 commented
I tried converting the example here:
https://github.com/pboyer/verb/blob/master/example/threeMeshIntersectExample.html#L345
to be a parabolic concave surface but am totally new to NURBS. I thought this would work but it doesn't, and I can't seem to find any help online :/
var degree = 2
, knots = [0, 0, 1, 1]
, pts = [ [ [0, 0, 0], [10, 0, 10], [20, 0, 10] , [30, 0, 0] ],
[ [0, 10, 0], [10, 10, 10], [20, 10, 10] , [30, 10, 0] ]
]
, wts = [ [ 1, 1, 1, 1],
[ 1, 1, 1, 1]
];
srf1 = new verb.NurbsSurface( degree, knots, degree, knots, pts, wts );
Do you think you provide a parabolic surface example, and also an example of a few cycles of a sine wave? Is there some way I can specify a curve using math operators like sin and cos, without computing a bunch of polylines myself?
nmz787 commented
OK, here's what I figured out. Seems to look like a parabola, though I am not sure how to confirm this:
function parabolic_channel(length, width, depth){
var half_width = width/2;
var half_length = length/2;
var degree = 2
, knots = [0, 0, 0, 1, 1, 1]
, pts = [ [ [-half_width, -half_length, 0], [0, -half_length, depth], [half_width, -half_length, 0] ],
[ [-half_width, 0 , 0], [0, 0 , depth], [half_width, 0 , 0] ],
[ [-half_width, half_length , 0], [0, half_length , depth], [half_width, half_length , 0] ]
]
, wts = [ [ 1, 1, 1],
[ 1, 1, 1],
[ 1, 1, 1]
];
srf1 = new verb.NurbsSurface( degree, knots, degree, knots, pts, wts );