Thanks for this solution. In the mean while I tried another solution, which seems more simple. My main vector is indeed in the XY plane. I have drawn lines (using Orient) in the right amplitude at both the start point of my vector as on the end point. I have made these lines extremely long in both directions. Than I cut these lines at the intersections. The length of my new lines are my substracted vectors. simple! Just like the old school days. :)
Cheers, Bas On Dec 31 2008, 4:55 am, visose <[email protected]> wrote: > Let's see, i did it using some basic math, but maybe there's a simpler > way. > For simplification, let's say you are working on 2D and the XY plane, > so you have the following equation: > a = X*b + Y*c > where 'a' is the initial vector, and 'b' and 'c' are the two unit > vectors you want to find the magnitude (right now they are unit > vectors).You want to find X and Y. > > Since we are in 2d we have two numbers for every vector (x and y > coordinates), so we actually have two formulas: > a.x = X*b.x + Y*c.x > and > a.y = X*b.y + Y*c.y > Using substitution you get the following equations: > (a.y -a.x*c.y/c.x)/(-b.x*c.y/c.x + b.y) for X > (a.y -a.x*b.y/b.x)/(-c.x*b.y/b.x + c.y) for Y > Place this formulas into expression components, then use the magnitude > or multiply vector components to create the two final components. > > The 3 vectors must be on the same plane, but maybe they are not in the > XY plane. For this i would use the 'orient' component to bring them to > the x,y plane and then use it again to bring them back to its initial > position. > > There's probably a way of doing this using the vector components > without so much equation, I'm not sure. > > On Dec 30, 9:58 pm, basbasbas <[email protected]> wrote: > > > > > Dear Visose, > > > I want to decompose it to two vectors not oriented to world > > coordinates and generaly not perpendicular to my vector. > > > Cheers, > > Bas > > > On 30 dec, 20:27, visose <[email protected]> wrote: > > > > What exactly are you trying to achieve? > > > You want to decompose the vector into two other perpendicular vectors? > > > like when you want to calculate a diagonal force you decompose it in X > > > and Y forces. You want to decompose it to vectors not oriented to > > > world coordinates? > > > You want to get the magnitude of one vector, divide it by 2, and apply > > > it to two other vectors no matter what the direction of the first > > > vector is? > > > or something else? > > > > If it's the first case it's easy, since vectors in grasshopper (and > > > rhino) are defined by 3 perpendicular components (x,y,z) and not by > > > magnitude and angle, you just need to use the 'decompose vector' > > > component, no need to do any trigonometry. > > > > On Dec 30, 6:10 pm, basbasbas <[email protected]> wrote: > > > > > Hi, > > > > > I have a vector that I want to divide into two new vectors with known > > > > directions. What is the best way to proceed? > > > > > Cheers, > > > > Bas Goris
