Hello Mustafa,

Since your working with land parcels, I guess you meant region/polygon
rather than polyline? Here is a MB implementation of a clockwise test
function. You simply pass in the object and the part number (to handle
multi-polygon regions) and it returns whether the polygon is clockwise as
TRUE or FALSE.

Regards,
Warren Vick
Europa Technologies Ltd.
http://www.europa-tech.com

Tel: +44 (0)20 8398 3955 x201

---8<--Cut here--8<---

function IsClockwise(byval TestObj as object, byval Part as smallint) as
logical
   dim NrPnts, i as integer
   dim a, x, y, Old_x, Old_y as float
   dim rc as logical

   rc = FALSE

   NrPnts = objectinfo(TestObj, OBJ_INFO_NPOLYGONS+Part)-1

   Old_x = objectnodex(TestObj, Part, 1)
   Old_y = 0.0
   a = 0.0

   i = 1

   while i <= NrPnts
      i = i + 1
      a = a + (Old_x - objectnodex(TestObj, Part, i)) * (Old_y +
objectnodey(TestObj, Part, i) - objectnodey(TestObj, Part, 1))
      Old_x = objectnodex(TestObj, Part, i)
      Old_y = objectnodey(TestObj, Part, i) - objectnodey(TestObj, Part, 1)
   wend

   a = a + (Old_x - objectnodex(TestObj, Part, 1)) * Old_y

   if a < 0.0 then
      rc = TRUE ' Clockwise
   end if

   IsClockwise = rc
end function

-----Original Message-----
From: Mustafa VZGET]N [mailto:[EMAIL PROTECTED] 
Sent: 23 November 2004 16:39
To: [EMAIL PROTECTED]
Subject: MI-L Polyline direction ???


Hi all. I have 2 questions:
 
First, In MapInfo there is a polyline direction (in the object's drawing
direction). Can we 
programmatically (ie via Mapbasic) obtain this direction (as clockwise or
counter-clockwise)?
 
Secondly, my actual purpose is: I have a parcel and I want to put a house in
that parcel so that 
1) The 3 walls of the house will be 4 meters inside (and parallel to) the 3
parcel sides.
2) The area of the house will be 70% of the parcel's area. (In this way the
house will be closed up with the 4th side.)
 
The shape of the parcel may be rectangle, trapezoid or more complicated. I
need a strong and general algorithm which will work with even bad parcel
shapes. I have found it difficult to decide which  of the 2 parallel lines
belong to the inner part of the parcel. (There are 2 identical lines which
are 4-meters equidistant from a line.) Anyone suggest an algorithm or point
me in the right direction?
 
Thanks...

                
---------------------------------
Do you Yahoo!?
 Meet the all-new My Yahoo! - Try it today! 



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14225

Reply via email to