Re: [Factor-talk] matrix inversion

2010-12-15 Thread Joe Groff
On Dec 15, 2010, at 7:51 PM, Randy Voet wrote:

> Hi,
> 
> I'm looking for matrix (4x4) inversion. I've found
> math.matrices.elimination, but I've come across a problem:
> 
> { 0.5 0.5 0.0 } translation-matrix4
> { 0.0 0.0 1.0 } pi 0.5 * rotation-matrix4 m.
> dup inverse m.
> 
> This results in
> 
> { { 1.0 0.0 0.0 0.0 }
>  { 0.0 1.0 0.0 -0.4... }
>  { 0.0 0.0 1.0 0.0 }
>  { 0.0 0.0 0.0 1.0 } }
> 
> instead of the identity matrix (though the difference is small, just one 
> cell).

Hi Randy. It looks like the "inverse" function is indeed wrong. Here's the 
result of "inverse":

( scratchpad ) { 0.5 0.5 0.0 } translation-matrix4
( scratchpad ) { 0.0 0.0 1.0 } pi 0.5 * rotation-matrix4 m.
( scratchpad ) inverse .
{
{ 0.0 1.0 0.0 -0.9065658975290974 }
{ -1.0 6.123233995736766e-17 0.0 0.4999 }
{ 0.0 0.0 1.0 0.0 }
{ 0.0 0.0 0.0 1.0 }
}

Compared against manually inverting the components:

( scratchpad ) { 0.0 0.0 -1.0 } pi 0.5 * rotation-matrix4
( scratchpad ) { -0.5 -0.5 0.0 } translation-matrix4 m. .
{
{ 6.123233995736766e-17 1.0 0.0 -0.5 }
{ -1.0 6.123233995736766e-17 0.0 0.4999 }
{ 0.0 0.0 1.0 0.0 }
{ 0.0 0.0 0.0 1.0 }
}

Aside from numerical error, the 3x3 submatrix looks correct; however, the 
fourth column of the "inverse" result is off by { -0.4 0 0 }.

-Joe--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Using tuple inheritance, mixins gives me results I don't understand and lack the skills to debug/fix.

2010-12-15 Thread Joe Groff
On Dec 16, 2010, at 7:38 AM, Jim mack wrote:

> I read that and experimented enough to learn my mixin expectations from Ruby 
> didn't serve me :)  But, in my pasted code, I only defined dispatch methods 
> for the mixins.  Are you saying that the tuples can't be related by 
> inheritance at all?

Factor mixins have nothing to do with Ruby mixins—they're essentially just open 
union types. You inherit mixin membership when you inherit from a tuple. Your 
child tuples thus end up as members of two mixins, and you define methods on 
both mixins the child tuples are members of. The resolution of ambiguous mixin 
methods is ill-defined (I think it happens to be alphabetical currently).

-Joe
--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Using tuple inheritance, mixins gives me results I don't understand and lack the skills to debug/fix.

2010-12-15 Thread Jim mack
I read that and experimented enough to learn my mixin expectations from Ruby
didn't serve me :)  But, in my pasted code, I only defined dispatch methods
for the mixins.  Are you saying that the tuples can't be related by
inheritance at all?

Thanks,
Jim

On Wed, Dec 15, 2010 at 5:53 PM, Joe Groff  wrote:

> On Dec 16, 2010, at 6:52 AM, Jim mack wrote:
>
> > Teaser: 4 tuple 'brothers' each have distinct mixin.  Mixins have generic
> words.  Tuples do not have any generic words defined.  Out of six calls
> through tuples, two trigger the wrong mixin.
>
> Inheritance and mixin dispatch don't mix. Try using a pure mixin hierarchy
> instead to get the behavior you expect—make a mixin hierarchy mirroring your
> tuple hierarchy, and have the child mixin classes be members of the parent
> mixin classes.
>
> -Joe
>
> --
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Using tuple inheritance, mixins gives me results I don't understand and lack the skills to debug/fix.

2010-12-15 Thread Joe Groff
On Dec 16, 2010, at 6:52 AM, Jim mack wrote:

> Teaser: 4 tuple 'brothers' each have distinct mixin.  Mixins have generic 
> words.  Tuples do not have any generic words defined.  Out of six calls 
> through tuples, two trigger the wrong mixin.

Inheritance and mixin dispatch don't mix. Try using a pure mixin hierarchy 
instead to get the behavior you expect—make a mixin hierarchy mirroring your 
tuple hierarchy, and have the child mixin classes be members of the parent 
mixin classes.

-Joe
--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Using tuple inheritance, mixins gives me results I don't understand and lack the skills to debug/fix.

2010-12-15 Thread Jim mack
Teaser: 4 tuple 'brothers' each have distinct mixin.  Mixins have generic
words.  Tuples do not have any generic words defined.  Out of six calls
through tuples, two trigger the wrong mixin.

On Tue, Dec 14, 2010 at 10:47 PM, Jim mack  wrote:

> The code:
> http://paste.factorcode.org/paste?id=2075
> The tests revealing problems or my misunderstanding of expectations:
> http://paste.factorcode.org/paste?id=2076
>
> --
> Jim
> "I'm for extending the working Medicare program for our seniors all the way
> back to contraception, so Americans can concentrate on living their lives
> without fear of changing a job, going bankrupt from deductibles or fighting
> HMO bureaucracy."
>



-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] matrix inversion

2010-12-15 Thread Randy Voet
Hi,

I'm looking for matrix (4x4) inversion. I've found
math.matrices.elimination, but I've come across a problem:

{ 0.5 0.5 0.0 } translation-matrix4
{ 0.0 0.0 1.0 } pi 0.5 * rotation-matrix4 m.
dup inverse m.

This results in

{ { 1.0 0.0 0.0 0.0 }
  { 0.0 1.0 0.0 -0.4... }
  { 0.0 0.0 1.0 0.0 }
  { 0.0 0.0 0.0 1.0 } }

instead of the identity matrix (though the difference is small, just one cell).
Did I do something wrong or is this a bug?

best regards
Randy

--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk