I'm writing a BSP tree program. How do I classify a polygon as above or below a plane?
I don't know much about Matrix or Vector math so if it the answer does involve it could you explain how it pertains to classifying polygons?
I'm writing a BSP tree program. How do I classify a polygon as above or below a plane?
I don't know much about Matrix or Vector math so if it the answer does involve it could you explain how it pertains to classifying polygons?
Copyright © 2021 Jogjafile Inc.
Lets say we have a plane with normal
n = (n1, n2, n3)
and d its perpendicular distance from the origin.If you have a point x that is on the plane, then
if d has a positive or negative sign is not strictly defined. But we can formulate this as
if
z>0
then a point is above the plane.Now for a polygon p we have to do this for all points/vertices, lets stay in 3D we get 3 values for z.
NOTE: Depending on the setting errors from floating point arithmetics can be relatively high and even up to
~1e-2
for points that are actually on the plane.A similar question and answers can be found here and some hints on alternate forms.