Mapping 3-Space to 2-Space

Started by
6 comments, last by fmulder145 14 years, 11 months ago
Can anyone help? I have a set of points in 3-Space (X, Y, and Z) that I would like to map to 2-Space so that 2D algorithms may be applied. In particular, I am looking at a Line Segment intersection on X and Y values. I thought about just not counting the Z coordinate but I don't think that is right - or is it? Ideas?
Advertisement
If you are testing to see if 2 lines in 3d space intersect, you will have to do full on 3d intersection tests.

If, however, you want to know if looking at them from directly above, the lines cross, you can ignore the Z and just do a 2d test with X and Y.

Does that help?

If not can you post more details about what you are trying to do?
If your talking about triangles, you can drop the z variable, and then do a 2d ray intersect 2d triangle. However this is not as accurate as performing the full 3d ray intersect 3d triangle.
-goodbye-
Well, the angle of view could be from top, bottom, left, right, or anywhere in between so I can not really assume to just remove the z-coordinate (at least I don't think so).

A more detailed example of what I am doing would be to imagine a face (say F0) made-up of 4 or more 3-Space vertices and another face (say F1) that overlaps part of it - they could be coplanar or not. I am trying to remove sections of face F0 where F1 overlaps. When they are coplanar, I can just use 2D applications of Line Segment Intersections and this works fine otherwise there is an issue. I would like to "flatten" face F1 to the same plane as F0 and apply the aforementioned operation. I believe this should result in the same effect?

Thank you for your assistance.
Quote:Original post by Hello Kitty
If your talking about triangles, you can drop the z variable, and then do a 2d ray intersect 2d triangle. However this is not as accurate as performing the full 3d ray intersect 3d triangle.


The "proper" way is to see what axis in the triangle normal has the largest magnitude and drop that axis.
You could also project the faces onto a plane to make them coplanar, e.g. by using F0's plane.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Thanks for all the great ideas guys. I believe the simplest answer to my problem would be as Lord_Evil suggested, to project the face onto the F0's plane.

Can anyone point me in the direction that would show how to compute a point in 3-Space to a Plane such as a link? Also, once my operations on the "projected" coordinates are complete - how to re-project back into 3-Space?

Again, thank you for all the help :)
Cool,

I got half the problem finished (I think)! I can project one face to another, I can then apply the 2D segment cuts. However, I don't seem to be able to reproject the results back. The code follows:

// a is the vertex of the FACE being projected onto the Plane
// of the argument face
public IVertex project(IVertex a, Face face) throws NCATGeomException {
if (a == null || face == null) {
throw new TopologyException("Attempt to Project with Invalid " +
"parameters!");
}
if (face.getSurfaceNormal() == null) {
// Compute Surface NORMAL of Face argument ...
face.computeNormal();
}
// The Face Normal ...
IVertex fcNorm = new Vertex(face.getSurfaceNormal());
fcNorm.normalize(); // "Normalize" range ...
// The PROJECTED Vertex to be returned ...
IVertex a1 = new Vertex(a);
// Scalar Projection ...
double spj = a1.dot(fcNorm);
fcNorm.scale(spj);
a1.sub(fcNorm);
return a1;
}

public void computeNormal() throws TopologyException, NCATGeomException {
if (this.list == null || this.size() == 0 || this.size() < 3) {
throw new TopologyException("Attempt to compute Normal on " +
"INVALID Vertices!");
} else {
IVertex a = new Vertex(this.getVertex(0));
IVertex b = new Vertex(this.getVertex(this.size() - 1));
IVertex c = new Vertex(this.getVertex(1));
b.sub(a);
c.sub(a);
// The "surface normal" is cross-product ...
this.surfaceNormal = c.crossProduct(b, c);
}
}


I thought if I reproject the results back to the original Plane using the above code the result should be perfect, but that is not working. Any ideas?

Again thanks for all the great ideas

This topic is closed to new replies.

Advertisement