2

I know the command Circle can do that too, however, I want to be more flexible later on and want to know how to define this with the above mentioned functions. Thanks in advance!

Kay
  • 1,035
  • 7
  • 19
  • 1
    Why not use something like this? Graphics[{Black, Thickness[.1], CapForm["Round"], Circle[{0, 0}, ArmRadius + WireRadius, {0, -90 Degree}]}] If you only want one end to be round, you can make two halves, one of which has CapForm["Butt"]. – Jens Mar 21 '16 at 20:48
  • This solution does not offer complex shaped designs... My example just serves as a guide. Being completly flexible seems to work only with BezierCurve or BSplineCurve(as I imagine). However, I completly failed trying any solution on that basis. – Kay Mar 21 '16 at 21:00
  • 1
    I think you'll have to explain what more complex shape designs you are looking for, otherwise the answer may end up being too narrow for your purpose. – Jens Mar 21 '16 at 21:16
  • true, got the point! However, I think it would help, if I know, how to define a quarter of a circle by BSplineCurve. As far as I understood BezierCurve is just able to approximate a quarter of a circle. where BSplineCurvecan treat that exact. Is that true? – Kay Mar 22 '16 at 12:44
  • Some info on how to construct a circle with rational splines: https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline#Example:_a_circle – shrx Mar 22 '16 at 13:19
  • @shrx - you beat me to it! – Jason B. Mar 22 '16 at 13:21
  • http://mathematica.stackexchange.com/a/79785/2079 – george2079 Mar 22 '16 at 14:02
  • Also worth pointing out a bug that still exists in version 10.3: Where is the other half of my fourth degree Bézier curve? – Jens Mar 22 '16 at 15:24

1 Answers1

5

This will give a quarter of a circle,

Graphics[BSplineCurve[{{1, 0}, {1, 1}, {0, 1}},
  SplineWeights -> {1, Sqrt[2]/2, 1},
  SplineKnots -> {0, 0, 0, 1, 1, 2}]
 ]

enter image description here

and this gives the whole circle,

Graphics[BSplineCurve[{{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 
    0}, {-1, -1}, {0, -1}, {1, -1}, {1, 0}},
  SplineWeights -> {1, Sqrt[2]/2, 1, Sqrt[2]/2, 1, Sqrt[2]/2, 1, 
    Sqrt[2]/2, 1},
  SplineKnots -> {0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4}]]

enter image description here

I got the info to make these from a combination of this page and this page. This page looks very useful for digging into the theory behind it all.

Jason B.
  • 68,381
  • 3
  • 139
  • 286