Adding snap_plane regression test for q3map2. I understand the SnapPlane()

problem now after reading the code, and it's a horrid problem.  Horrific.


git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/Rambetter-math-fix-experiments@397 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
rambetter 2010-12-31 22:24:37 +00:00
parent 3916fca24c
commit d51c4e9830
6 changed files with 138 additions and 4 deletions

View file

@ -2,7 +2,7 @@ DESCRIPTION OF PROBLEM:
======================= =======================
The example map, maps/segmentation_fault.map, contains an example of this The example map, maps/segmentation_fault.map, contains an example of this
bug. q3map2 will segfault while compiling this map. This sort of thing bug. q3map2 might segfault while compiling this map. This sort of thing
might happen in certain intermediate versions of q3map2 while work is being might happen in certain intermediate versions of q3map2 while work is being
done on fixing the math accuracy. The bug may not have happened in older done on fixing the math accuracy. The bug may not have happened in older
version of q3map2, before the math accuracy issues were addressed. version of q3map2, before the math accuracy issues were addressed.
@ -22,6 +22,6 @@ Here is a description of the problem brush (brush #0):
side 5: -x face side 5: -x face
side 6: problem side "accidentally showed up" :-) side 6: problem side "accidentally showed up" :-)
Side 6 is actually a superfluous plane and will be NULL'ed out in the code.
SOLUTION TO PROBLEM: If the code does not handle a NULL'ed out winding correctly, it will
==================== segfault.

View file

@ -0,0 +1,45 @@
DESCRIPTION OF PROBLEM:
=======================
The example map, maps/snap_plane.map, contains an example of some bugs.
The green brush with the red face is transformed into something totally
unexpected.
To trigger the bug, compile the map; you don't need -vis or -light. Only
-bsp (the first q3map2 stage) is necessary to trigger the bug. The only
entities in the map are a light and a info_player_deathmatch, so the map will
compile for any Q3 mod.
SOLUTION TO PROBLEM:
====================
I actually came up with this regression test after reading the code to
SnapPlane() and SnapNormal(). I decided to make this map as a test of
whether or not I understand how the code is broken. Sure enough, the map
is broken in the same way that I would expect it to be broken.
The problem is that the red face of the green brush in the center of the room
is very close to being axially aligned, but not quite. This plane will
therefore be "snapped" to become axial. This is not the problem. The
problem is that after the snap, the plane will be shifted a great deal,
and the corner of the green brush will no longer come even close to meeting
the corner of the other cube brush next to it (the two corners of the two
brushes will drift apart a great deal).
If you study the legacy SnapPlane() code, you will see that planes are
defined as a unit normal and distance from origin. Well, because
of the position of this brush on the side of the world extents (far from
the original), the snap will cause drastic effects on the points that the
plane was supposed to approximate.
Another problem with SnapPlane() is that SnapNormal() snaps too liberally.
Once SnapNormal() is changed to only snap normals that are REALLY close
to axial (and not anything within 0.25 degrees), this bug will no longer
appear, but the SnapPlane() problem will still be present. So, this
regression test should be fixed BEFORE SnapNormal() is fixed, otherwise
create another regression test with a red face that is much much closer to
being axially aligned. We want to make sure that SnapPlane() is fixed when
things actually do get snapped.
The code to address these issues is currently being worked on.

View file

@ -0,0 +1,89 @@
// entity 0
{
"classname" "worldspawn"
// brush 0
{
( -54784 5760 -64 ) ( -54976 5760 -64 ) ( -54976 5632 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54976 5632 0 ) ( -54976 5760 0 ) ( -54784 5760 0 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54976 5632 0 ) ( -54784 5632 0 ) ( -54784 5632 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54784 5632 0 ) ( -54784 5760 0 ) ( -54784 5760 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54784 5760 0 ) ( -54976 5760 0 ) ( -54976 5760 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54976 5760 0 ) ( -54976 5632 0 ) ( -54976 5632 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( -53808 5616 -64 ) ( -55064 5616 -64 ) ( -55064 4944 -64 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -55072 4944 0 ) ( -55072 5616 0 ) ( -53816 5616 0 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -55040 4096 8 ) ( -53784 4096 8 ) ( -53784 4096 0 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -54272 4936 8 ) ( -54272 5608 8 ) ( -54272 5608 0 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -53816 5632 8 ) ( -55072 5632 8 ) ( -55072 5632 0 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -54784 5592 8 ) ( -54784 4920 8 ) ( -54784 4920 0 ) radiant_regression_tests/green 0 0 0 0.500000 0.500000 0 0 0
( -54528 5632 -64 ) ( -54272 5631 -64 ) ( -54528 5632 0 ) radiant_regression_tests/red 0 0 0 0.500000 0.500000 0 0 0
}
// brush 2
{
( -54200 5904 -128 ) ( -55032 5904 -128 ) ( -55032 5824 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55024 5824 192 ) ( -55024 5904 192 ) ( -54192 5904 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 5824 0 ) ( -54208 5824 0 ) ( -54208 5824 -64 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -54208 5824 0 ) ( -54208 5904 0 ) ( -54208 5904 -64 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54200 5832 0 ) ( -55032 5832 0 ) ( -55032 5832 -64 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 5904 0 ) ( -55040 5824 0 ) ( -55040 5824 -64 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
// brush 3
{
( -54144 5824 -128 ) ( -54208 5824 -128 ) ( -54208 5424 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 5424 192 ) ( -54208 5824 192 ) ( -54144 5824 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54160 4032 192 ) ( -54096 4032 192 ) ( -54096 4032 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54200 5424 192 ) ( -54200 5824 192 ) ( -54200 5824 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54144 5824 192 ) ( -54208 5824 192 ) ( -54208 5824 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 5824 192 ) ( -54208 5424 192 ) ( -54208 5424 -128 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
}
// brush 4
{
( -54208 4032 -128 ) ( -54760 4032 -128 ) ( -54760 3944 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54760 3944 192 ) ( -54760 4032 192 ) ( -54208 4032 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54752 4024 192 ) ( -54200 4024 192 ) ( -54200 4024 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 3944 192 ) ( -54208 4032 192 ) ( -54208 4032 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 4032 192 ) ( -54760 4032 192 ) ( -54760 4032 -128 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -55040 4016 192 ) ( -55040 3928 192 ) ( -55040 3928 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
// brush 5
{
( -55040 5824 -128 ) ( -55256 5824 -128 ) ( -55256 5256 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55256 5256 192 ) ( -55256 5824 192 ) ( -55040 5824 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55256 4032 192 ) ( -55040 4032 192 ) ( -55040 4032 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 5256 192 ) ( -55040 5824 192 ) ( -55040 5824 -128 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -55040 5824 192 ) ( -55256 5824 192 ) ( -55256 5824 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55048 5808 192 ) ( -55048 5240 192 ) ( -55048 5240 -128 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
// brush 6
{
( -54208 4032 192 ) ( -55040 4032 192 ) ( -55040 4024 192 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -55016 4024 200 ) ( -55016 4032 200 ) ( -54184 4032 200 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 4032 296 ) ( -54208 4032 296 ) ( -54208 4032 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 4024 296 ) ( -54208 4032 296 ) ( -54208 4032 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54200 5824 296 ) ( -55032 5824 296 ) ( -55032 5824 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 4032 296 ) ( -55040 4024 296 ) ( -55040 4024 192 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
// brush 7
{
( -54192 4560 -136 ) ( -55024 4560 -136 ) ( -55024 4552 -136 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 4024 -128 ) ( -55040 4032 -128 ) ( -54208 4032 -128 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( -55040 4032 -128 ) ( -54208 4032 -128 ) ( -54208 4032 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 4024 -128 ) ( -54208 4032 -128 ) ( -54208 4032 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -54208 5824 -120 ) ( -55040 5824 -120 ) ( -55040 5824 -248 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( -55040 4032 -128 ) ( -55040 4024 -128 ) ( -55040 4024 -256 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
}
// entity 1
{
"light" "1000"
"origin" "-54664 5696 40"
"classname" "light"
}
// entity 2
{
"angle" "360"
"origin" "-54840 5696 88"
"classname" "info_player_deathmatch"
}