If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Spatial Data Type: PL SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-05, 09:37
adventure_ke adventure_ke is offline
Registered User
 
Join Date: Nov 2004
Posts: 13
Spatial Data Type: PL SQL

I am trying to solve this where i am trying to check if a Certain Point are inside a box

A point has Xval and Y val (numeric)
A box has fields BOTTOM and TOP which are TYPE POINT

On a grid where a box is placed:
A point on the top right corner is Y Value (top), X value (right)
A point on the bottom right corner has Y value (bottom), and X value (left)

Therefore i wrote this :

create or replace type POINT as object
(xval number, yval number,
member function x return number,
member function y return number
)

create or replace type body point as
member function X return number is
begin
return xval;
end;
member function y return number is
begin
return yval;
end;
end;

I have created type point with member function X,Y with returns XVAL and YVAL above

I now need to create Type Box with member function which returns 1 or 0 (true or false)

If points(x,y) are inside a box then:

if (left <=x) and (x<=right)) and ((bottom <=y) and (y<=top))
then return 1; //contains point in box if true
else return 0; / contains point in box if false
end if;

CAN YOU HELP WITH THIS, i unsure in PL /SQL?

I started with :

create or replace type box as object
( point1 number, point 2 number,
member function ContainPB( aPoint Point) return number)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On