Raised This Month: $ Target: $400
 0% 

Point inclusion, Zone points generation, and Zone drawing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 09-08-2013 , 21:23   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #1

well, that's almost what blaacky did and it isn't muuuch faster than his method. although, it's muuuuch faster than mine.
however, my method will always work and yours won't.
__________________
sie sind das essen und wir sind die jäger!

Last edited by Bimbo1; 09-08-2013 at 21:25. Reason: mah engrish suckz
Bimbo1 is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-09-2013 , 01:22   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #2

This method will always work, providing you store the mins and maxs of your zone properly, and you should, since you need proper mins/maxs to create the zone.

Now.. a zone is a cube. It can be defined by 6 points (lower corner (mins) and upper corner (maxs)) you do not need any other information. You can calculate more if you wish to convert it to an entity-based object, by subtraction to find the center of the cube(or rectangle) to obtain the absolute origin, and then the distance from that origin to the mins and maxs (relative to the origin). By using this, you can create brush entities (which use relative mins/maxs).

Using these methods, it is never neccessary to store more than 6 points for a zone.

Now, the function I posted will tell you if a POINT exists in a zone, not if an ENTITY exists in a zone.
If you wish to test if an ENTITY exists in a zone, you will have to either:
1) know information about the entity, such as it's size/shape/mins/maxs and then do some simple maths to see if it intersects.
2) know if the entity has an odd X/Y rotation (mins don't rotate dynamically) - that is .. if you h ave say a plank, and you turn it, the bounding box (mins/maxs) of that plank will NOT represting if it is touching the zone - so you need to either: a) see if you can use brushes to touch test for you, or b) use some complex vector maths to fire trace rays along the original mins/maxs and rotate some crosshatch or something to that effect, or c) approximate it's size (extrapolate it from the object's mins/maxs) and then test the origin distance from the zone origin + some offset of the zone's size (this not exact by any means).

I guess you could create skewed zones... then you need 8 points but that just seems silly, and goes against optimization and much of the logic and commonsense that the engine uses regarding hitboxes, bounding boxes, sequence boxes, etc etc.

Then again, you could make spherical zones. Then all you need to do is test distance from origin, even easier.

You could really create them in any shape you want, it's totally arbitrary, but remember that brush entities and most objects use 2 points -> rectangle/cube
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 09-09-2013 at 01:29.
friagram is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 09-09-2013 , 15:20   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #3

i wouldn't say that calculating skewed zones is silly. it's need to calculate intersections between boxes at any positions and angles. it's not always that a regular zone defined by mins and maxs will fit your needs.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-16-2013 , 13:31   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #4

Quote:
Originally Posted by Bimbo1 View Post
i wouldn't say that calculating skewed zones is silly. it's need to calculate intersections between boxes at any positions and angles. it's not always that a regular zone defined by mins and maxs will fit your needs.
Right, and to calculate an intersection? What exactly do you mean by that?
If you want to see if two bodies collide, there is some simple math you can do to test it using mins/maxs since you know where the collision point will/can be.. Then just test that point.

There is a reason the engine uses squares that can be defined by 2 points and not skewed ones (rhombohedrons). Likewise, you could use a decahedron to define a zone, but the math is much simpler to use a sphere, since all you need to define it is one point and a length (radius). 4 floats beats 33 or whatever that would be.

If you really have a strange region, it will still be faster, and you will get more coverage, using two squares and 4 points... Than checking one with 8.. In the long run.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 09-16-2013 at 13:36.
friagram is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 09-16-2013 , 13:47   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #5

uhm, but i still don't see how i would calculate the intersection with only two squares and four points. and the engine use skewed zones, i mean, it's possible to rotate a trigger, isn't it?
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-16-2013 , 22:00   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #6

Quote:
Originally Posted by Bimbo1 View Post
uhm, but i still don't see how i would calculate the intersection with only two squares and four points. and the engine use skewed zones, i mean, it's possible to rotate a trigger, isn't it?
A brush entity has a model, defined by multiple points (verts). But all brush entities also have mins and maxs, which do not rotate. If you rotate a model in hammer, you will see that the bounding box will increase in size when it turns diagonally.. But models have sequence boxes defining their absolute size (cubes)' as well as mins/maxs, and possbly phymesh. Each is used for different things, but obviously it doesnt use the phymesh fo all calculations, as it is way too costly. Pretty sure bullets and such use hitboxes first rather than phymesh, unless it is some special kind of raycast, but i could be wrong.

Calculating intersections with 2 points is the basis lf tracehullfilters if i am not mistaken
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 09-16-2013 at 22:04.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode