Hi,
In order to do some 3D calculations (on a windows system), I reused
a few lines found in extra directory.
> : deg>rad ( x -- y ) pi * 180 / ;
> : make-matrix ( quot width -- matrix ) >r { } make r> group ;
> : 3D-R ( angle -- R ) deg>rad
[ dup cos , dup sin neg , 0.0 ,
dup sin , dup cos , 0.0 ,
0.0 , 0.0 , 1.0 , ] 3 make-matrix nip ;
> 30 3D-R
> dup pprint
{
{ 1 0 0 }
{ 0 0.8660254037844387 -0.4999999999999999 }
{ 0 0.4999999999999999 0.8660254037844387 }
}
I then tried the word "solution" defined in math.matrices.elimination;
> solution
> dup pprint
{
{ 1.0 0.0 0.0 }
{ 0.0 0.0 1.0 }
{ 0.0 1.0 2.080123565747723e+16 }
}
The result is not very nice, I expected to get something like
{
{ 1.0 0.0 0.0 }
{ 0.0 1.0 0.0 }
{ 0.0 0.0 1.0 }
}
After a while I understood that cos and sin return double
: fcos ( x -- y ) "double" "libm" "cos" { "double" } alien-invoke ;
foldable flushable
and it seems there is a round up conflict with word zero? used in
solution.
I fixed my app with this new definition
: make-matrix ( quot width -- matrix ) >r { } make [ float>bits
bits>float ] map r> group ;
but it would be great if you could you give me a nicer way to handle
this type of conflict.
thanks
Jeff Bigot
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk