Jump to content

  • Log In with Google      Sign In   
  • Create Account


Determine the 3d position of this vector


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 gretty   Members   -  Reputation: 211

Like
0Likes
Like

Posted 13 March 2014 - 10:57 PM

Hello

 

I have a rather simple mathematic problem to solve. However I am not that mathematically inclined so I'd appreciate if someone could provide advice on how I solve this mathematic problem:

 

For the following triangle I wish to find the location (X,Y & Z) of the point/vector C. How can I find this position?

 

295eb89.png

 

Using simple Pythagoras I can find the length of side Z. But how can I find the position of C? I am attempting to offset/parallel a straight line segment (side X) so I need to calculate the position of C.



Sponsor:

#2 VildNinja   Members   -  Reputation: 426

Like
1Likes
Like

Posted 13 March 2014 - 11:30 PM

First of don't use x, y and z for anything but coordinates.. that's just confusing. Call the sides a, b and c or something else.

 

The problem is unsolvable with only two initial points, as this will produce a wheel of possible positions of C around A, remember this is 3D, so there exists infinite directions orthogonal to the vector (AB).

 

If you have an up vector and know that A, B and C are all in the "ground" plane orthogonal to the up vector you can find C:

 

// by taking the cross product between two vectors you get a direction vector that is orthogonal to both (A - B) and up

v = Cross((A - B), up)

// by normalizing the vector v and multiplying with the length of y you scale the direction to the right length

directin = Normalize(v) * y

// you can now easily find C

C = A + direction

 

But this is only if A, B and C is in the ground plane.



#3 krinosx   Members   -  Reputation: 511

Like
0Likes
Like

Posted 14 March 2014 - 08:08 AM


The problem is unsolvable with only two initial points, as this will produce a wheel of possible positions of C around A, remember this is 3D, so there exists infinite directions orthogonal to the vector (AB).

 

Hummm I think he must find the 'formula' or the equation representing the C position... it may be defined in function of A, B and its angles/values... right?? I dont know how to get its formula... but I think gretty is trying to achieve it ( the formula, not the real value of C )...

 

Its righ Gretty?



#4 VildNinja   Members   -  Reputation: 426

Like
0Likes
Like

Posted 14 March 2014 - 10:00 AM

 


The problem is unsolvable with only two initial points, as this will produce a wheel of possible positions of C around A, remember this is 3D, so there exists infinite directions orthogonal to the vector (AB).

 

Hummm I think he must find the 'formula' or the equation representing the C position... it may be defined in function of A, B and its angles/values... right?? I dont know how to get its formula... but I think gretty is trying to achieve it ( the formula, not the real value of C )...

 

Its righ Gretty?

 

 

The formula for finding C is

 

C = A + (Normalize(Cross((A - B), ??)) * y)

 

Where ?? is any vector not zero or parallel to (A - B)



#5 Buckeye   Crossbones+   -  Reputation: 4390

Like
0Likes
Like

Posted 14 March 2014 - 10:23 AM

C = A + Normalize( Cross( B-A, Cross(A,B) ) )  * y;

 

Cross(A,B) is a non-unit "up" vector, normal to AB.

 

B-A is a non-unit vector from A to B.

 

Cross(B-A, Cross(A,B)) is normal to both AB and "up," i.e., points from A to C, normalized to a unit vector for applying the length of the side (y).


Edited by Buckeye, 14 March 2014 - 10:25 AM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#6 VildNinja   Members   -  Reputation: 426

Like
1Likes
Like

Posted 14 March 2014 - 10:39 AM

C = A + Normalize( Cross( B-A, Cross(A,B) ) )  * y;

 

Cross(A,B) is a non-unit "up" vector, normal to AB.

 

B-A is a non-unit vector from A to B.

 

Cross(B-A, Cross(A,B)) is normal to both AB and "up," i.e., points from A to C, normalized to a unit vector for applying the length of the side (y).

Yes, but that's still assuming that C is also in the plane with the normal "up" gretty didn't specify that.



#7 Buckeye   Crossbones+   -  Reputation: 4390

Like
0Likes
Like

Posted 14 March 2014 - 03:21 PM


assuming that C is also in the plane

You're absolutely correct. Missed that.


Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#8 WiredCat   Members   -  Reputation: 238

Like
0Likes
Like

Posted 15 March 2014 - 02:15 PM

so is this topic answered? because when i see crossproduct little kittens begin to cry in heaven.

Anyway relating to that question. if its 90 degs it seems that C can be on either left or right side according to B position in relation to A. if you have distance between A and C why you dont  just add this value to specified vector component?



#9 VildNinja   Members   -  Reputation: 426

Like
2Likes
Like

Posted 15 March 2014 - 07:48 PM


if its 90 degs it seems that C can be on either left or right side according to B position in relation to A.

In 2D yes, but this is 3D. This means that any point on a circle with the radius y around A is a valid point C.

 

Also: Vikings cheer in Valhal whenever people mention the cross product! You might as well learn to use it, it is quite useful in vector math :)

 

Read up: http://en.wikipedia.org/wiki/Cross_product



#10 JohnnyCode   Members   -  Reputation: 228

Like
0Likes
Like

Posted 16 March 2014 - 08:19 AM

realize that infinite amount of vectors C fits the definition you have described in 3d. More precisely, all vectors that begin from point A by length y orthogonal to (A-B). This yeilds vectors that create a circle which you can imagine by rotation of the triangle around (A-B) edge. 

 



#11 gretty   Members   -  Reputation: 211

Like
0Likes
Like

Posted 16 March 2014 - 07:12 PM

Thanks for the replies. You'll have to bear with me because for all the complex procedural programming concepts I understand, I struggle with mathematics.

 

If we take a step back; what I am trying to do is parallel a straight line segment. Therefore the point C will be one side of the paralleled line and I will create another point adjacent to B as the other point of that same paralleled line. Can you provide some advice on how I can parallel that straight line segment?

 

 

 


The problem is unsolvable with only two initial points, as this will produce a wheel of possible positions of C around A, remember this is 3D, so there exists infinite directions orthogonal to the vector (AB).

 

If I remove the 3d aspect, can you provide advice on how I can find point C's location and/or parallel a straight line segment in 2d? Is it simply a case of adding the offset(y value) to vector A? For eg:

Vector3 c = a + new Vector(y, 0, 0);  // y is the triangle length value from the OP picture
vector3 d = b + new Vector(y, 0, 0);

For the following line; if I use the above code wont that produce this result though?

af94lk.png    116l8b8.png

 

So I have to consider the 2d rotation aswell right?


Edited by gretty, 16 March 2014 - 07:24 PM.


#12 VildNinja   Members   -  Reputation: 426

Like
0Likes
Like

Posted 18 March 2014 - 08:07 AM

Not sure if I understand the question.

 

But if the line segment (AB) if parallel to the y-axis then C can be found by your above code.

 

I don't understand what the relation between the points are. Is D the other end of a line segment (CD)? Also is the red picture wrong or the initial state of something.

 

Please make a picture with A, B, C and D and the line you have plus the one you want to find.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS