summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-10-23 21:32:41 +0000
committerIan C <ianc@noddybox.co.uk>2005-10-23 21:32:41 +0000
commit2c4a357e8f8e62fe50ab489519990e91e718c0d0 (patch)
treed587698deb16ac4bace2729a10098d7f188d711e
parentae52db78e5b6697562f0e7b0e1f92dec94c1b063 (diff)
Changed handling of invalid calls
-rw-r--r--vectorgfx.mod/vectorgfx.bmx17
1 files changed, 14 insertions, 3 deletions
diff --git a/vectorgfx.mod/vectorgfx.bmx b/vectorgfx.mod/vectorgfx.bmx
index fbf5064..3da763a 100644
--- a/vectorgfx.mod/vectorgfx.bmx
+++ b/vectorgfx.mod/vectorgfx.bmx
@@ -328,10 +328,13 @@ Type TVectorGfxObject
bbdoc: Whether a point is inside the object
returns: True if the point lies inside the object. The object is assumed to be a closed polygon for this test.
about: @cx, @cy is the point to test.
- about: Calling it before drawing the object will cause runtime errors.
about: This routine is based on code from comp.graphics.algorithms FAQ 2.03
EndRem
Method IsInside:Int(cx:Int, cy:Int)
+ If rotated=Null
+ Return False
+ EndIf
+
Local cross:Int=False
For Local l:TVectorGfxLine=EachIn lines
@@ -352,9 +355,13 @@ Type TVectorGfxObject
bbdoc: A line's adjusted co-ordinates.
returns: The rotated and scaled points (in object co-ordinates) of the line.
about: @i is the index of the line to return the points for.
- about: Calling it before drawing the object will cause runtime errors.
+ about: Calling it before drawing the object will return null.
EndRem
Method AdjustedCoords:TVectorGfxPoint[](i:Int)
+ If rotated=Null
+ Return Null
+ EndIf
+
Local p:TVectorGfxPoint[]=New TVectorGfxPoint[2]
Local l:TVectorGfxLine=lines[i]
p[0]=rotated[l.i1]
@@ -366,9 +373,13 @@ Type TVectorGfxObject
bbdoc: A line's normal.
returns: The normal of the selected line.
about: @i is the index of the line to return the normal of. This will return the normal due to the rotation of the object after the object is drawn.
- about: Calling it before drawing the object will cause runtime errors.
+ about: Calling it before drawing the object will return null.
EndRem
Method Normal:TVector(i:Int)
+ If rotated=Null
+ Return Null
+ EndIf
+
Local l:TVectorGfxLine=lines[i]
Local v:TVector=TVector.Create(rotated[l.i2].y-rotated[l.i1].y,rotated[l.i1].x-rotated[l.i2].x)
v.Normalise()