Raised This Month: $ Target: $400
 0% 

Point inclusion, Zone points generation, and Zone drawing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 08-28-2013 , 14:24   Re: Point inclusion, Zone points generation, and Zone drawing
Reply With Quote #1

This should be useful aswell

PHP Code:
/**
 * Checks if two zones intersect (overlap).
 *
 * @param fCheck        First zone (8 given points).
 * @param fSource       Second zone (8 given points).
 * @return              True if they intersect, false otherwise.
 */

stock bool:ZonesIntersect(Float:fCheck[8][3], Float:fSource[8][3]) {
    if (
fCheck[0][0] > fSource[4][0] ||    // fCheck is right of fSource
        
fCheck[4][0] < fSource[0][0] ||    // fCheck is left of fSource
        
fCheck[1][2] < fSource[0][2] ||    // fCheck is below fSource
        
fCheck[0][2] > fSource[1][2] ||    // fCheck is above fSource
        
fCheck[3][1] < fSource[1][1] ||    // fCheck is behind fSource
        
fCheck[1][1] > fSource[3][1]) {    // fCheck is in front fSource
        
return false;
    }

    return 
true;


Last edited by floube; 08-28-2013 at 14:28.
floube 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