Maths - Projections of lines on lines - comments by minorlogic

By: martinbaker ( Martin Baker )
file Projections of lines on lines  
2003-10-06 03:49

Some time ago we had a discussion here on another subject but which involved projections, it took me a long time to get round to it but I have gathered some information on the following page:
https://www.euclideanspace.com/maths/geometry/elements/line/projections/

As always I would welcome your thoughts, comments, etc.

Martin

By: minorlogic ( Michaele Norel )
file RE: Projections of lines on lines  
2003-10-06 07:36

Hi Martin !

the "Calculation of the parallel component" is a classic and very efficient !

I am not sure what yoy mean with "perpendicular component "

But if i undestand right what is a "perpendicular component " than we can just substitute from A the paralel component.

This is my code i use:
"
// return projection v1 on to v2
inline vector3 projection( const vector3& v1, const vector3& v2 )
{
float v2_ls = v2.len_squared();
if( v2_ls > TINY )
{
return v2 * ( dot( v2, v1 )/v2_ls );
}else{
return vector3(0,0,0);
}
}
//------------------------------------------------------------------
// return orthogonal_component of v1 on v2
// i.e. the distance from v2 point to v1 line
inline vector3 orthogonal_component( const vector3& v1, const vector3& v2 )
{
float v2_ls = v2.len_squared();
if( v2_ls > TINY )
{
return v1 - v2 * ( dot( v2, v1 )/v2_ls );
}else{
return vector3( 0, 0, 0);
}
}
"

By: martinbaker ( Martin Baker )
file RE: Projections of lines on lines  
2003-10-06 10:41

Hi minorlogic,

Yes, you're right it does need explaining. How about the projection of A onto a line which is parallel to B and is in the plane of both vectors.

Put that way it sounds a bit contrived and I don't know if it has any practical uses but it does seem to show some interesting links and symmetries in the equations.

Thanks for the code, I'll add it to the web page.

Martin

By: minorlogic ( Michaele Norel )
file RE: Projections of lines on lines  
2003-10-07 03:54

Hi Martin !
I see i understand it coorect. Than the

"perpendicular component" + "paralel component" = A

OR

"perpendicular component" = A - "paralel component"

Little more effitient than 2 cross products.

This both is a very usefull in practice.

The "paralel component" ( projection of B into A) is usefull in dynamics and collision solve and e.t.

The "perpendicular component" is used for distance calculation from line to point and many many others.

Sometimes it is included as "vector" class members.
I think it is usefull post it on own web page.
//----------

For example i for a long time calculated projections using normalisation of vector ( the unefficient with sqrt , and i did it many in dynamic calculations ), and it was a shame for me to discover the way like you post.


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

flag flag flag flag flag flag New Foundations for Classical Mechanics (Fundamental Theories of Physics). This is very good on the geometric interpretation of this algebra. It has lots of insights into the mechanics of solid bodies. I still cant work out if the position, velocity, etc. of solid bodies can be represented by a 3D multivector or if 4 or 5D multivectors are required to represent translation and rotation.

 

Other Math Books

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.