Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Confining a point in a rectangle

Hi,

This problem involves more of algebra and geometry. I rely on excel to
perform some calculations.

I have two parallel slopes (+'ive) and two slopes which is
perpendicular to these two slopes (-'ive). This design makes a
rectangle and I have a point (x,y). My objective is to come up with
conditions which will check whether a point is within this rectangle
or not and assign a value.

In my current design, I have two positive slopes A and B that are
parallel and have different y-intercepts (slope A at the bottom and
slope B and the top). I have two negative slopes C and D that are
perpendicular to A and B and also have different y-intercepts (slope D
at the bottom and slope C at the top) . This makes a rectangle.

The conditions that I have come up with is: m - slope and c -
intercept
A slope - yma(x)+ca
B slope - y<mb(x)+cb
C slope - y<mc(x)+cc
D slope - ymd(x)+cd

I have noticed that this conditon only works for 0 to 90 degrees. But
if i happen to shift my rectange to another angle beyond 90 degrees
and apply the same thing to 90-180, or 180-270 or 270-360 degrees, it
doesnt work. Can anyone suggest any solution to my logic. Thanks

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Confining a point in a rectangle

In almost every computer solution dealing with such things, I've had to treat
the 4 cardinal points (0, 90, 180, 270) as unique exceptions and specifically
test for them. In some cases (depending on the application) when such an
angle was encountered, then an intentional error of some small fraction of a
degree can be introduced to prevent the failure. In some applications this
is acceptable, in others it is not.

" wrote:

Hi,

This problem involves more of algebra and geometry. I rely on excel to
perform some calculations.

I have two parallel slopes (+'ive) and two slopes which is
perpendicular to these two slopes (-'ive). This design makes a
rectangle and I have a point (x,y). My objective is to come up with
conditions which will check whether a point is within this rectangle
or not and assign a value.

In my current design, I have two positive slopes A and B that are
parallel and have different y-intercepts (slope A at the bottom and
slope B and the top). I have two negative slopes C and D that are
perpendicular to A and B and also have different y-intercepts (slope D
at the bottom and slope C at the top) . This makes a rectangle.

The conditions that I have come up with is: m - slope and c -
intercept
A slope - yma(x)+ca
B slope - y<mb(x)+cb
C slope - y<mc(x)+cc
D slope - ymd(x)+cd

I have noticed that this conditon only works for 0 to 90 degrees. But
if i happen to shift my rectange to another angle beyond 90 degrees
and apply the same thing to 90-180, or 180-270 or 270-360 degrees, it
doesnt work. Can anyone suggest any solution to my logic. Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to place a colored rectangle BEHIND some data cells? Big Greg. New Users to Excel 2 May 10th 07 11:04 AM
Delete a rectangle using a macro [email protected] Excel Discussion (Misc queries) 2 September 29th 05 08:21 PM
Copy Rectangle Object From One Sheet To Another GeorgeF Excel Discussion (Misc queries) 0 May 24th 05 07:08 PM
Formatting Auto Shapes - Rectangle Woody13 Excel Discussion (Misc queries) 1 May 19th 05 07:50 PM
Can I use excell to draw a rectangle and come up with square feet Paul Excel Worksheet Functions 6 May 13th 05 02:18 AM


All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"