Raised This Month: $ Target: $400
 0% 

Boundries


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-10-2005 , 23:22   Boundries
Reply With Quote #1

Say I had four points like so:

*-----------------*
|//////////////////|
|\\\\\\\\\\\\\\\\\\|
|//////////////////|
|\\\\\\\\\\\\\\\\\\|
*-----------------*

How could I tell if something was inside of those four points (the slashes)?

I know I could prolly look @ xero's OOB plugin, but I'm too lazy for that.

PS: You can compliment on my beloved artwork later.. ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-11-2005 , 17:04  
Reply With Quote #2

Theoretically:
If you have a 2D box and a 2D point, you can test if the point is inside the box like by comparing the X,Y coordinates:

The Box:

Code:
// (bx,by)
//     *-------------*
//     |             | 
//     |  (px,py)    | bh
//     |     *       | 
//     *-------------*
//             bw
(Point X, Y == px and py)
(Box X, Y == bx, by)
(Box Width == bw)
(Box Height == bh)

Just imagine those are your variables, you could do:

Code:
if( px >= bx && px <= (bx + bw) && py >= by && py <= (by + bh) ) {     // Inside box }else {     // Outside box }

The same theory applies to 3D Boxes/Points, just add the extra coordinate checks for Z!

This is basically what I've done in OOB..
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-11-2005 , 20:20  
Reply With Quote #3

Ah.. I knew you'd be the one to reply!

Hmm... I'll have to figure this out.. It's still kinda confusing for me.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply


Thread Tools
Display Modes

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 16:49.


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