Jump to content
  • Advertisement
Sign in to follow this  

Cross product problem

This topic is 2286 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

pv1->y = vtx

pv1->z = vtx

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

D3DXVec3Cross( v_res,
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 :



p3.jpg Edited by Thermal Blast

Share this post

Link to post
Share on other sites
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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!