4
$\begingroup$

I am trying to make a pretzel shape,but I cannot seem to get the loops even.

Eventually, I need to make the pretzel shape loop in 3D so I need to nail the 2D concept first. Here's what I have so far.

pts = {{0, 0, 0}, {2, 2, 0}, {4, 0, 0}, {1, 2, 0}, {2, 4, 0}, {3, 2, 0}};
curve = Graphics3D[BSplineCurve[points, SplineClosed -> True]];
Graphics3D[{BSplineCurve[pts, SplineClosed -> True], Green, Line[pts],
   Red, Point[pts]}]

enter image description here

Any suggestions on how to proceed ?

$\endgroup$
5
  • $\begingroup$ mathworld.wolfram.com/KnotCurve.html $\endgroup$ Mar 10, 2015 at 20:30
  • 1
    $\begingroup$ wolframalpha.com/input/?i=pretzel+curve $\endgroup$ Mar 10, 2015 at 20:31
  • $\begingroup$ I have to use a Bezier curve.. it's for homework. $\endgroup$
    – Johnny
    Mar 10, 2015 at 20:37
  • 1
    $\begingroup$ You'll have better luck if you make your control polygon have three-fold symmetry. $\endgroup$
    – user484
    Mar 10, 2015 at 22:06
  • 1
    $\begingroup$ Try playing around with something like Inkscape or Illustrator to get a handle on how bezier curve work (pun fully intended). Or try out this game. $\endgroup$ Mar 10, 2015 at 23:44

1 Answer 1

7
$\begingroup$

You can use a LocatorPane to edit the control points (at least in 2 dimensions) and see the curve change in real time:

pts = RandomReal[{-1, 1}, {5, 2}];

LocatorPane[Dynamic[pts],
 Dynamic[Graphics[
   {
    BSplineCurve[pts],
    Dotted, Line[pts]
    }, PlotRange -> {{-1, 1}, {-1, 1}}]]]

enter image description here

If you play around with the points a little, getting a pretzel shouldn't be too difficult.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.