Unknown value - just or fun.

Started by
4 comments, last by Buckeye 9 years, 7 months ago

Given the vertices for a poygon (tri or quad) , the face vertex list, and the normal for the polygon, a single floating point number is also given.

Question is what does the value relate to?

example 1

v1 30.9, 234.51, -4.32
v2 -114.77, 117.93, 36.38
v3 52.97, 117.93, 145.31

normal -0.390294 0.697474, 0.601

unknown value -148.91

example 2

v1 -59.72, 163.79, 98.19
v2 -5.21, 177.91, 16.89
v3 10.44, 119.18, 88.13

normal 0.520179, 0.711538, 0.472364

unknown value -131.862

We are porting a viewer to linux and mac, the unknown value isn't essential for the program, just wondering what it is.

Advertisement

It's the 4th parameter "d" in the equation for the plane formed by the vertices: ax + by + cz + d = 0.

a, b, and c in that equation are the components of the normal to the plane.

FYI, I only checked v1 in the 2nd set of vertices.

EDIT: The parameter d is the negative of the distance from the origin to the plane along the plane normal - see Alvaro's post below: d = -dot_product(normal, any-point-in-the-plane).

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

You don't forget how to play when you grow old; you grow old when you forget how to play.

Buckeye is right.

value = -dot_product(normal, v1) = -dot_product(normal,v2) = -dot_product(normal,v3)

Wow thanks,

never seen that before, any ideas for it's use?

(The program being ported is used to create unfolded nets from 3D geometry.)

FYI, I think the normals are negated not the distance.

The triangle is contained in a plane. If you want to test whether a point is to one side of the plane or the other, you simply check the sign of `dot_product(point - origin, normal) + value'.

Re: how plane equations are used - collision detection, raycasting, determining the point in the plane closest to a given point - all of which would use the form of the plane equation Alvaro mentions.

The latter use would be something like:

Given point V, assuming origin is (0,0,0):

D = dot_product(V, normal) + d

Closest point in the plane to V: P = V - D*normal

That may be where you see the normal negated.

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

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement