Logarithmic Spiral - Is Point on Spiral (cartesian coordinates

前端 未结 4 1309
囚心锁ツ
囚心锁ツ 2021-01-26 13:14

Lets Say I have a 3d Cartesian grid. Lets also assume that there are one or more log spirals emanating from the origin on the horizontal plane.

If I then have a point in

4条回答
  •  佛祖请我去吃肉
    2021-01-26 13:27

    Unfortunately, you will need to know some mathematics notation anyway - this is a good read about the logarithmic sprial.

    http://en.wikipedia.org/wiki/Logarithmic_spiral

    we will only need the top 4 equations.

    For your question 1 - to control the tightness, you tune the parameter 'a' as in the wiki page. - to control the direction, you offset theta by a certain amount.

    For your question 2

    In floating point arithmetic, you will never get absolute precision, which mean there will be no point falling exactly on the sprial. On the screen, however, you will know which pixel get rendered, and you can test whether you are hitting a point that is rendered.

    To render a curve, you usually render it as a sequence of line segments, short enough so that overall it looks like a curve. If you want to know whether a point lies within certain distance from the spiral, you can render the curve (on a off-screen buffer if you wish) by having thicker lines.

提交回复
热议问题