Questions on mathematical reprsentation of Plane

Started by
7 comments, last by alvaro 1 year, 1 month ago

I have joined a new company and I saw this on their plane definition

// Coordinates of the minimum point in the box
Vector3<T> m_root;

// Coordinates of the maximum point in the box
Vector3<T> m_normal;

// Coordinates of the u direction
Vector3<T> m_udir;

// Coordinates of the v direction
Vector3<T> m_vdir;

I am not a math guro and I just know the high level representation of a plane, a point in the plane and a normal, in the above this can be the m_root and the m_normal. But I dont understand what the U and V direction is for.
In the code, it is initialized as the direction that points in the X and Z direction (normalized) while the normal is initialized as pointing to positive Y axis. Is there any mathematical explanation what these vectors are, does this only points to the X/Z direction, or always perpendicular to the normal vector.
I am not sure why they have these as for me normal and a point can already represent the plane.
Any math people can help?

Advertisement

If you had only a normal, the direction of the coordinates would be ambiguous. Either u or v are needed; adding both wastes a lot of space but it is symmetrical and more practical than recomputing a cross product every time.

Initializing u, v and normal to the global x, y and z axes is only a convention for a plane that will be rotated and translated later. Can you find the maintenance of the invariants that the three directions are mutually perpendicular and unit length? Do you use only “trusted” transformation matrices?

Omae Wa Mou Shindeiru

Can't you ask this in your new company?

Someone should know ?

But anyway, you can also define a plane as a vector to the origin and 2 vectors pointing in different directions (as in vec1 * M ≠ vec for all values M). A commonly used plane with that definition is the XY plane, with origin at (0, 0) and vectors (1, 0) and (0, 1). In that way you have a coordinate system in the plane, coordinate (21, 15) is well-defined.

EDIT: LorenzoGatti was faster

@Alberth I work remotely and I want to do my due deligence of checking/studying on it first before i throw-in and ask questions, Thanks for the reply!

@LorenzoGatti can you explain a little what you mean by “the direction of the coordinates would be ambiguous”? I though plane is infinite and only needs the direction and any point in the plane.

second question, I assume that U and V vectors are always orthogonal to normal vector and to each other right? and I understand it avoids recomputation of cross product everytime.

cebugdev2 said:
can you explain a little what you mean by “the direction of the coordinates would be ambiguous”?

I read that as trying to point at other spots in the plane. Say you have a base vector and a normal. How do you point at the spot, say 1 unit to the left (for whatever notion of left you like)?

While with a plane described by an origin and 2 base vectors every point at the plane can be indicated by “origin + N * vec1 + M * vec2”, and the (N, M) pair is unique for each point.

cebugdev2 said:
I assume that U and V vectors are always orthogonal to normal vector and to each other right?

Not sure but orthogonal to the normal vector makes sense, as u and v are then in the plane.

Orthogonal to each other is possible and has some advantages (especially if you want to relate things to the XYZ axes). For having coordinates at a plane however it's not necessary, the unit rectangle just won't have 90 degrees angles at the corners.

For example in the XY plane, assume vectors (1, 0), and (2, 1). Coordinate (1, 2) with these vectors is at 1 * (1, 0) + 2 * (2, 1) = (5, 2) in XY coordinates.

cebugdev2 said:

@LorenzoGatti can you explain a little what you mean by “the direction of the coordinates would be ambiguous”? I though plane is infinite and only needs the direction and any point in the plane.

A point of the plane (usually u=0 and v=0) and a normal direction identify the plane only up to rotation. You also need to choose a line in the plane to be the axis with u=0 (or v=0, or any other line equation); the other axis can be deduced because it is mutually perpendicular, but you still need to choose the sign (left-handed or right-handed).

Omae Wa Mou Shindeiru

The minimum information needed to describe a plane in 3D is 4 numbers (A, B, C, D) which give you the equation of the plane: A*x+B*y+C*z+D=0. You can describe the plane in other ways, but they all are giving you more information than just the plane, and I would try to find a better name for the class than just “Plane”. For instance, you can have a point p on the plane and two vectors (v, w) so any point on the plane can be written as p+a*v+b*w. That one I would call PlaneFrame or something like that. You can add a normal to the plane, which is redundant because you can always get a normal as cross_product(v,w), but perhaps you use this so often that you want to have it precomputed. That would explain all the members you described. It doesn't explain what that “box” in the comments is, though.

This topic is closed to new replies.

Advertisement