Mathematica Asked by Lyle Ramshaw on December 18, 2020

Mathematica seems to render rational Bézier curves (drawn with `BSplineCurve`

) using polylines whose segments can be annoyingly long, while polynomial Bézier curves (drawn with `BezierCurve`

) behave better. Consider, for example,

```
Graphics[{Blue,
BezierCurve[{{-0.05, 0}, {0, 0.02}, {0.05, 0}},
SplineDegree -> 2],
Red,
BSplineCurve[{{-0.05, 0.05}, {0, 0.07}, {0.05, 0.05}},
SplineDegree -> 2, SplineWeights -> {1, 1, 1}]},
PlotRange -> {{-1, 1}, {-0.1, 0.2}}, AspectRatio->Automatic]
```

Those two quadratic Bezier curves should differ only by a small vertical translation. When I execute that code (in version 11.3), however, the default image looks like this:

with the upper, red curve rendered as a straight line. If I stretch the image a bit, the red curve becomes a two-segment polyline:

Stretching the image further causes the red curve to acquire three segments, and so forth.

How can I control the accuracy with which `BSplineCurve`

‘s are converted into polylines? The straight segments in my current images, while they are fairly short, still generate corners that are sharp enough to be obvious bugs.

(with thanks to Mr. Wizard.)

There is an *undocumented* option you can use to control the rendering of B-splines:

```
Graphics[{Blue, BezierCurve[{{-0.05, 0}, {0, 0.02}, {0.05, 0}}, SplineDegree -> 2],
Red, BSplineCurve[{{-0.05, 0.05}, {0, 0.07}, {0.05, 0.05}},
SplineDegree -> 2, SplineWeights -> {1, 1, 1}]},
BaseStyle -> {BSplineCurveBoxOptions -> {Method -> {"SplinePoints" -> 30}}},
PlotRange -> {{-1, 1}, {-0.1, 0.2}}]
```

Increase or decrease the `"SplinePoints"`

setting as seen fit.

Correct answer by J. M.'s discontentment on December 18, 2020

1 Asked on February 23, 2021 by gravifer

1 Asked on February 23, 2021

2 Asked on February 23, 2021

1 Asked on February 23, 2021 by corvus

3 Asked on February 23, 2021 by vincius-figueiredo

1 Asked on February 23, 2021

big numbers diophantine equations number theory prime numbers procedural programming

1 Asked on February 23, 2021

differential equations mathematical optimization numerical integration numerics warning messages

5 Asked on February 23, 2021 by user1585

0 Asked on February 23, 2021

2 Asked on February 23, 2021 by steve237

0 Asked on February 22, 2021

bugs calculus and analysis differential equations equation solving logic

2 Asked on February 22, 2021 by ag1123

0 Asked on February 22, 2021

Get help from others!

Recent Answers

- haakon.io on Why fry rice before boiling?
- Lex on Does Google Analytics track 404 page responses as valid page views?
- Joshua Engel on Why fry rice before boiling?
- Peter Machado on Why fry rice before boiling?
- Jon Church on Why fry rice before boiling?

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir