[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get X/Y-extent of a bezier-curve?
From: |
Thomas Morley |
Subject: |
Re: How to get X/Y-extent of a bezier-curve? |
Date: |
Fri, 9 Oct 2015 14:12:48 +0200 |
2015-10-09 8:20 GMT+02:00 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> 2015-10-07 14:08 GMT+02:00 Thomas Morley <address@hidden>:
>>
>>> The code in my initial mail uses coord-rotate (not
>>> ly:stencil-rotate-absolute as in Jans suggestion)
>>> What do you think about this method?
>>>
>>> Ofcourse it was heavily simplified, maybe best to put up a patch to
>>> have the full code for more detailed discussion.
>>
>> I have to postpone uploading the patch, there are some glitches ...
>>
>> And one thing which has driven me crazy, before I found the culprit:
>> `coord-rotate' has a problem which can be demonstrated with:
>>
>> (display (coord-rotate '(10 . 0) (/ PI 2)))
>>
>> Expected: (0 . 10)
>> Actually: (6.12323399573677e-16 . 10.0)
>>
>> What's the best method to get the zero?
>
> coord-translate is written awfully (almost any intermediate use of atan
> is an indicator of unnecessary contortions) but that's not the problem
> here. The problem is that GUILE stores floating point number as double
> numbers (64 bits), and the MPU does its calculations, including
> trigonometry, using long double arithmetic (80 bits on x86).
> Consequently, there is no representation of PI in GUILE that would lead
> to the expected results.
Ok, thanks for the explanation.
>
> When angles are represented un GUILE, you are probably indeed best off
> using degrees rather than radians since small multiples of 45 are
> exactly representable at any number resolution available to GUILE.
Well, coord-rotate uses sin and cos for the final result. They both
expect their argument as radians. Converting them with
`degrees->radians' involves PI again.
So far the obvious ...
Consequently I tried to redefine coord-rotate without depending on PI
or at least without trigonometric functions.
Up to now without result.
Actually, I have no clue how to.
Maybe I fallback to some rounding like Ed suggested (thanks for that)
Something at the lines of `close-enough?' from music-functions.scm
>
> The code used in ly:stencil-rotate-absolute looks like it might work
> (though I'd write (a * (M_PI / 180.0)) rather than (a * M_PI / 180.0)).
If I understand this correctly (and I probably don't), I don't see how
it would help.
Thanks,
Harm
- How to get X/Y-extent of a bezier-curve?, Thomas Morley, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, David Kastrup, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, Thomas Morley, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, David Kastrup, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, Thomas Morley, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, David Kastrup, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, Thomas Morley, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, Ed Gordijn, 2015/10/09
- Re: How to get X/Y-extent of a bezier-curve?, David Kastrup, 2015/10/09
- Re: How to get X/Y-extent of a bezier-curve?,
Thomas Morley <=
- Re: How to get X/Y-extent of a bezier-curve?, David Kastrup, 2015/10/09
- Re: How to get X/Y-extent of a bezier-curve?, BB, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, Thomas Morley, 2015/10/08
- Re: How to get X/Y-extent of a bezier-curve?, BB, 2015/10/08