Jump to content

  • Log In with Google      Sign In   
  • Create Account

Cross product problem


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
2 replies to this topic

#1 Pin ups   Members   -  Reputation: 148

Like
0Likes
Like

Posted 09 September 2012 - 02:26 PM

I have encountered a problem with a cross product calculation that I would like some help with if possible.
The problem is that I can create a vector that is perpendicular, ninety degrees to one of the axis but I want the vector to be perpendicular to both axis. The code for the cross product is like this and this creates the object in the images. The original quad is originally set to be very un orthographic (very un centered ) on all axis as a test.

I then brought the object into another application to get a better view of the object.

Your help would be very much appreciated with this.

The code :


pv1->x = vtx[p].pos.x;
pv1->y = vtx[p].pos.y;
pv1->z = vtx[p].pos.z;
pv2->x = vtx[p1].norm.x;
pv2->y = vtx[p1].norm.y;
pv2->z = vtx[p1].norm.z;

D3DXVec3Cross( v_res,
pv1,
pv2 );

vtx[4].pos.x = v_res->x;
vtx[4].pos.y = v_res->y;
vtx[4].pos.z = v_res->z ;

Returns a result of :

Posted Image


Posted Image

Posted Image

Edited by Thermal Blast, 09 September 2012 - 02:26 PM.


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7991

Like
1Likes
Like

Posted 10 September 2012 - 01:06 AM

It is somewhat unclear of what really is your issue. The cross product will calcualte the perpendicular vector of two given vectors, right ? Are you trying to calcualte the perpendicular edge of two other edges. The difference is, that an edge is a located 'vector', that is you have not only the direction given by a vector but although the position . If you have two edges with a shared vertex, then try something like this:

edge_1 = (v0,v1)
edge_2 = (v0,v2)
new_direction = crossProd( v1-v0, v2-v0)
new_edge = (v0, v0+new_direction)

Edited by Ashaman73, 10 September 2012 - 01:07 AM.


#3 Pin ups   Members   -  Reputation: 148

Like
0Likes
Like

Posted 10 September 2012 - 02:38 PM

Thank you, that looks like the very thing I have been looking for.




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