Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help creating parabola #8

Closed
nmz787 opened this issue Dec 31, 2014 · 1 comment
Closed

Need help creating parabola #8

nmz787 opened this issue Dec 31, 2014 · 1 comment

Comments

@nmz787
Copy link

nmz787 commented Dec 31, 2014

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
Copy link
Author

nmz787 commented Jan 1, 2015

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 );

@nmz787 nmz787 closed this as completed Jan 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant