Main Page About Ldoc+ Error Lists Main Index Index Groups

Ldoc+ Lingo Group:
    POINTs & RECTangles

 info D5/601:
      point() 
      rect() 
 6     9 elements new in Director 6.0,
  !   10 contain Dictionary fixes 601 & 501,
   +  NO 'Appendix' in 6.0 for POINTS/RECTS, but Online-Help!


Lingo Points (8):
  !   point()
 6    locH of point
 6    locV of point
      charPosToLoc(fieldMember)
  !   clickLoc
      loc of sprite
      point(the mouseH,the mouseV)
      regPoint of member

Lingo Rectangles (17):
  !   rect()
 6    left   of rect
 6    top    of rect
 6    right  of rect
 6    bottom of rect
 6    height of rect
 6    width  of rect
  !   deskTopRectList
  !   drawRect of the stage
      drawRect of window
      rect of member
      rect of sprite
  !   rect of the stage
      rect of window
  !   sourceRect of the stage
      sourceRect of window
x6    spriteBox (outdated - > rect of sprite)

Rectangle & Point Functions (9):
      ilk(x, #point), ilk(x, #rect), ilk(x, #list)
  !   inflate(rect)
      inside( point, rect )
  !   intersect(rect)
      map(point)
      map(rect)
      objectP(point/rect)
      offset(rect)
  !   union(rect)

--

601 POINT/RECT Lingo:
Revealed properties of points and rects for D5/601:
'the locH/locV of point()', and
'the left/top/right/bottom/height/width of rect()'.
Funny enough, the Dictionary's 'rect()' example avoids
using 'the width of targetRect'... ;-)

Outdated RECT Lingo (1):
 6                spriteBox -> rect of sprite





[index] _ D5/601 _ 971212:


inflate()

math rectangle scaling function

6.0 Dictionary Errors, partly the same in 5.0:

"...specifies how much the rectangle changes horizontally."
= Not exact; should read:
"...specifies how much the rectangle changes horizontally
    in both directions."

"...specifies how much the rectangle changes vertically."
= Not exact; should read:
"...specifies how much the rectangle changes vertically
    in both directions."

"Values less than 0 for horizontal or vertical reduce
 the rectangles size."
= Not exact; should read:
"Values less than 0 for horizontal or vertical CHANGE reduce
 the rectangles size accordingly."

"This statement increases...inflate(rect(0,0,100,100) -10, -10)"
= Wrong; Example 1 should read:
"This statement DEcreases...inflate(rect(0,0,100,100) -10, -10)"

= Missing:
"See Also: rect(), ilk(#rect), listP(rect), objectP(rect),
 union(rect), offset(rect), rect of sprite, rect of window"
 --






[index] _ D5/601 _ 971212:


intersect()

rectangle math function

6.0 Dictionary Errors, partly the same in 5.0:

"...where rectangle1 and rectangle2 intersect."
= Not exact; should read:
"...where rectangle1 and rectangle2 OVERLAP,
    indicating the area shared by both rectangles."

= Missing:
"If the rectangles don't overlap, the result is rect(0,0,0,0)."

= A usefull example is missing:
"put intersect( rect(9,9,99,99), rect(10,10,110,110) )
 -- rect(10, 10, 99, 99)"

= Missing:
"See Also:...ilk(#rect), listP(rect), objectP(rect), rect of sprite"
 --

"...where rectangle intersects rectangle Ramp"
= The 5.0 Dictionary should read:
"...where rectangle TOOLKIT intersects rectangle Ramp"
 --

1. TIP: If the two tested rectangles do NOT intersect, 'intersect(rect1,rect2)' returns 'rect(0,0,0,0)'. To get TRUE or FALSE for a test if two rectangles share any common area at all, test 'if NOT ( intersect(rect1,rect2) = rect(0,0,0,0) )'.

2. TIP: In 5.0, the expression 'rect(0,0,0,0) = 0' evaluates TRUE, but in Director 6.0, comparing a rect to an integer ALWAYS evaluates FALSE! For more info, see 'rect()'.

3. TIP: The two rectangles to test for overlapping by the 'intersect()' function can be placed in any order inside the parenthesis, more than two rectangles have to be tested step by step.

4. TIP: If one rectangle is completely inside the other, the 'intersect()' function will return the smaller rectangle's values.






[index] _ D5/601 _ 971212:


point()

point object and its properties

6.0 Dictionary Errors:

"These statement set..."
= Typo in Example 3; should read:
"These statements set..."

"This handler moves a named sprite to the location..."
= Cannot 'name' a sprite; Example 4 should read:
"This handler moves a DEFINED sprite to the location..."

= Example 4 is pretty lousy:
1. Instead of using 'theSprite', it should use the name 'mySprite'.
2. 'updateStage' is indented too much.
3. The example will not have any effect if the distance
   (the clickLoc - the loc of sprite 1) is smaller than 40!

= Missing:
"See Also: ... ilk(#point), listP(point), objectP(point),
 inside(point, rect), map(point), the clickLoc, loc of sprite,
 regPoint of member, charPosToLoc(fieldMember)"
 --

1. TIP: You can test AND set the 2 values of a point by using 'the locH of point(h,v)' and 'the locV of point(h,v)', also with 'the clickLoc' and 'the loc of sprite'.

2. TIP: You can use the 'addAt()', 'getAt()', and 'setAt()' list commands on points (and rects), and you can even add more entries into them than they actually have (a point normally has 2 and a rect has 4 entries).

3. TIP: You can perform math calculations with and on points; see 'setAt()' for EXAMPLEs, and see Peter Small's book 'Lingo Sorcery' for more info.

--

EXAMPLEs:

put the clickLoc
-- point(142, 348)

put the locH of the clickLoc
-- 142
put the locV of the clickLoc
-- 348





[index] _ D5/601 _ 971212:


rect()

rect object and its properties

6.0 Dictionary Errors:

"set targetWidth the right of targetRect - ..."
= Should read:
"set targetWidth = the right of targetRect - ..."
= Shorter:
"set targetWidth = the width of targetRect"

= Example 2 misses:
"put rect(firstPoint, secondPoint)
 -- rect(100, 150, 300, 400)"

= Missing:
"See Also: ... ilk(#rect), listP(rect), objectP(rect),
 inflate(rect), inside(), intersect(rect), map(rect),
 offset(rect), union(rect), rect of member, rect of sprite,
 drawRect of window, rect of window, sourceRect of window"
 --

1. TIP: In 5.0, the expression 'rect(0,0,0,0) = 0' evaluates TRUE, but in Director 6.0, comparing a rect to an integer ALWAYS evaluates FALSE!

2. TIP: A 'rect' always starts at a (virtual) position of 0, and not at 1, like the rect of a 640 x 480 stage: 'rect(0,0,640,480)', which would actually mean 641 by 481 pixels.

3. TIP: You can test AND set the 4 values of a rectangle 'rect(l,t,r,b)' by using its properties 'the left...', 'the top...', 'the right...' and 'the bottom of rect()', like you do with 'the left/top/right/bottom of sprite'.

4. TIP: You can test, but NOT set 'the width of rect(l,t,r,b)' to get the distance (r-l) between 'the left' and 'the right of rect()', and you can test, but NOT set 'the height of rect(l,t,r,b)' to get the distance (b-t) between 'the top' and 'the bottom of rect()'. This is useful when testing 'the height of the rect of the stage' or 'the width of the rect of sprite'.

5. TIP: You can use the 'addAt()', 'getAt()', and 'setAt()' list commands on rects (and points), and you can even add more entries into them than they actually have (a rect normally has 4 entries and a point has 2).

6. TIP: 'rect(0,0,0,0) + 123 = rect(123,123,123,123)'. You can perform math calculations with and on rects. Some of this is now also mentioned in the 6.0 Dictionary, thanks. See Peter Small's book 'Lingo Sorcery' for more info.

7. TIP: Different objects like members, sprites, the stage, movies-in-a-window (MIAWs), etc, have their own 'rect', which is always their bounding rectangle box (e.g. on stage or in Director's Paint window). See 'rect of member', drawRect of window, etc.

8. TIP: See 'intersect()', 'union()', and 'point()'.






[index] _ D5/601 _ 971212:


union()

math rectangle function

6.0 Dictionary Errors, same in 5.0:

"Syntax:  union rect rect1, rect2
= Wrong syntax; should read:
"Syntax:  union(rect1, rect2)"

This function definitely needs enclosing parenthesis,
and it will NOT accept the additional word 'rect'
(the Dictionary's example uses the correct syntax)!
--

1. TIP: The 'union(rect1,rect2)' function creates a new rectangle, which encloses both given rects. A different thing is adding one rect to the other: 'rect1 + rect2', which adds the according entry of the second rect to the equivalent entry in the first rect. For more info, see 'rect()'.

2. TIP: The two rectangles to be added together by the 'union()' function can be placed in any order inside the parenthesis, more than two rectangles have to be added step by step.

3. TIP: If one rectangle is completely inside the other, the 'union()' function will return the bigger rectangle's values. To test if both rectangles overlap, use the 'intersect(rect1, rect2)' function.

--

EXAMPLEs:

--> Wrong:
--
put union rect(0,0,50,50), rect(20,20,110,110)
-- <Void> rect(0, 0, 50, 50) rect(20, 20, 110, 110)

--> Syntax must be:
--
put union( rect(0,0,50,50), rect(20,20,110,110) )
-- rect(0, 0, 110, 110

put union( the rect of sprite 1, the rect of sprite 2 )
-- rect(81, 227, 97, 251)




(Top)

URL = "http://www.a3w.de/Lingo/Ldoc_Points_Rects.html"  (971212)

 Top [Main Page] [About...] [Error Lists] [Ldoc+ Index] [Lingo Groups]
The Ldoc+ © Copyright 97-98 by Denis Wieger Online since June 1, 1997. All rights reserved.
<mailto:Denis@a3w.de
 Top