Page 1 of 1

Routine for Decomposition of Vectors

Posted: Wed May 13, 2009 4:43 pm
by Lispzard
I only recently discovered the beauty of Lisp when I found two very useful routines for AutoCAD. The one, tlen.lsp calculates the length of segments and the other one plperp.lsp aids in drawing perpendicular lines. These gave me an idea that I could automate even more things and even have a whole program (I'm very far from such beautiful possibility) which would handle the tedious job of analyzing a particular set of vectors and ultimately torques in a construction. As a first step I'd like to ask you if you know of a routine that would decompose a vector along along given directions -- something like clicking on the vector and the two lines indicating the direction and, voila, the components are there. Thanks a lot for any attention this question may attract and hope I'm not in the wrong area of the forum, I just registered and yet don't have a clue as to what Lisp itself actually is (although I can program in Fortran, C++, VB.Net etc., not earning my living with it, though)

Re: Routine for Decomposition of Vectors

Posted: Thu May 14, 2009 7:55 am
by findinglisp
I moved this thread to the Other Dialects forum since it's about AutoLisp, not Common Lisp. Please keep topics categorized correctly. Thanks.

Re: Routine for Decomposition of Vectors

Posted: Sat May 16, 2009 7:06 am
by Jasper
Decomposing a vector is easy.. Just a bunch of inproducts. Say decompose to a,b,c then coordinate in that system is
(vector (inpr x a) (inpr x b) (inpr x c)) (a,b,c must be independent, of course, and even then they might not be orthogonal.)