2
0
Эх сурвалжийг харах

Renamed Distance() to DistanceTo()
Added braces to strings.

woollybah 6 жил өмнө
parent
commit
6e464c67dd
1 өөрчлөгдсөн 40 нэмэгдсэн , 16 устгасан
  1. 40 16
      vector.mod/vector.bmx

+ 40 - 16
vector.mod/vector.bmx

@@ -214,14 +214,14 @@ Struct SVec2
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector And @b.
 	bbdoc: Returns the distance between the vector And @b.
 	End Rem
 	End Rem
-	Method Distance:Double(b:SVec2)
+	Method DistanceTo:Double(b:SVec2)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
 	bbdoc: Returns the squared distance between the vector and @b.
 	bbdoc: Returns the squared distance between the vector and @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Double(b:SVec2)
+	Method DistanceToSquared:Double(b:SVec2)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -243,7 +243,13 @@ Struct SVec2
 	bbdoc: Returns a #String representation of the vector.
 	bbdoc: Returns a #String representation of the vector.
 	End Rem
 	End Rem
 	Method ToString:String() Override
 	Method ToString:String() Override
-		Return x + ", " + y
+		Local sb:TStringBuilder = New TStringBuilder
+
+		sb.Append("(")
+		sb.Append(x).Append(", ").Append(y)
+		sb.Append(")")
+		
+		Return sb.ToString()
 	End Method
 	End Method
 
 
 End Struct
 End Struct
@@ -401,14 +407,14 @@ Struct SVec3
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector and @b.
 	bbdoc: Returns the distance between the vector and @b.
 	End Rem
 	End Rem
-	Method Distance:Double(b:SVec3)
+	Method DistanceTo:Double(b:SVec3)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
 	bbdoc: Returns the squared distance between the vector and @b.
 	bbdoc: Returns the squared distance between the vector and @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Double(b:SVec3)
+	Method DistanceToSquared:Double(b:SVec3)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -432,9 +438,11 @@ Struct SVec3
 	Method ToString:String() Override
 	Method ToString:String() Override
 		Local sb:TStringBuilder = New TStringBuilder
 		Local sb:TStringBuilder = New TStringBuilder
 		
 		
+		sb.Append("(")
 		sb.Append(x).Append(", ")
 		sb.Append(x).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(z)
 		sb.Append(z)
+		sb.Append(")")
 		
 		
 		Return sb.ToString()
 		Return sb.ToString()
 	End Method
 	End Method
@@ -618,14 +626,14 @@ Struct SVec2F
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector And @b.
 	bbdoc: Returns the distance between the vector And @b.
 	End Rem
 	End Rem
-	Method Distance:Float(b:SVec2F)
+	Method DistanceTo:Float(b:SVec2F)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
-	bbdoc: Returns the squared distance between the vector and @b.
+	bbdoc: Returns the squared distance between the vector And @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Float(b:SVec2F)
+	Method DistanceToSquared:Float(b:SVec2F)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -647,7 +655,13 @@ Struct SVec2F
 	bbdoc: Returns a #String representation of the vector.
 	bbdoc: Returns a #String representation of the vector.
 	End Rem
 	End Rem
 	Method ToString:String() Override
 	Method ToString:String() Override
-		Return x + ", " + y
+		Local sb:TStringBuilder = New TStringBuilder
+
+		sb.Append("(")
+		sb.Append(x).Append(", ").Append(y)
+		sb.Append(")")
+		
+		Return sb.ToString()
 	End Method
 	End Method
 
 
 End Struct
 End Struct
@@ -805,14 +819,14 @@ Struct SVec3F
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector and @b.
 	bbdoc: Returns the distance between the vector and @b.
 	End Rem
 	End Rem
-	Method Distance:Float(b:SVec3F)
+	Method DistanceTo:Float(b:SVec3F)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
 	bbdoc: Returns the squared distance between the vector and @b.
 	bbdoc: Returns the squared distance between the vector and @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Float(b:SVec3F)
+	Method DistanceToSquared:Float(b:SVec3F)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -836,9 +850,11 @@ Struct SVec3F
 	Method ToString:String() Override
 	Method ToString:String() Override
 		Local sb:TStringBuilder = New TStringBuilder
 		Local sb:TStringBuilder = New TStringBuilder
 		
 		
+		sb.Append("(")
 		sb.Append(x).Append(", ")
 		sb.Append(x).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(z)
 		sb.Append(z)
+		sb.Append(")")
 		
 		
 		Return sb.ToString()
 		Return sb.ToString()
 	End Method
 	End Method
@@ -1022,14 +1038,14 @@ Struct SVec2I
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector And @b.
 	bbdoc: Returns the distance between the vector And @b.
 	End Rem
 	End Rem
-	Method Distance:Int(b:SVec2I)
+	Method DistanceTo:Int(b:SVec2I)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
 	bbdoc: Returns the squared distance between the vector and @b.
 	bbdoc: Returns the squared distance between the vector and @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Int(b:SVec2I)
+	Method DistanceToSquared:Int(b:SVec2I)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -1051,7 +1067,13 @@ Struct SVec2I
 	bbdoc: Returns a #String representation of the vector.
 	bbdoc: Returns a #String representation of the vector.
 	End Rem
 	End Rem
 	Method ToString:String() Override
 	Method ToString:String() Override
-		Return x + ", " + y
+		Local sb:TStringBuilder = New TStringBuilder
+
+		sb.Append("(")
+		sb.Append(x).Append(", ").Append(y)
+		sb.Append(")")
+		
+		Return sb.ToString()
 	End Method
 	End Method
 
 
 End Struct
 End Struct
@@ -1209,14 +1231,14 @@ Struct SVec3I
 	Rem
 	Rem
 	bbdoc: Returns the distance between the vector and @b.
 	bbdoc: Returns the distance between the vector and @b.
 	End Rem
 	End Rem
-	Method Distance:Int(b:SVec3I)
+	Method DistanceTo:Int(b:SVec3I)
 		Return (Self - b).Length()
 		Return (Self - b).Length()
 	End Method
 	End Method
 	
 	
 	Rem
 	Rem
 	bbdoc: Returns the squared distance between the vector and @b.
 	bbdoc: Returns the squared distance between the vector and @b.
 	End Rem
 	End Rem
-	Method DistanceSquared:Int(b:SVec3I)
+	Method DistanceToSquared:Int(b:SVec3I)
 		Return (Self - b).LengthSquared()
 		Return (Self - b).LengthSquared()
 	End Method
 	End Method
 	
 	
@@ -1240,9 +1262,11 @@ Struct SVec3I
 	Method ToString:String() Override
 	Method ToString:String() Override
 		Local sb:TStringBuilder = New TStringBuilder
 		Local sb:TStringBuilder = New TStringBuilder
 		
 		
+		sb.Append("(")
 		sb.Append(x).Append(", ")
 		sb.Append(x).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(y).Append(", ")
 		sb.Append(z)
 		sb.Append(z)
+		sb.Append(")")
 		
 		
 		Return sb.ToString()
 		Return sb.ToString()
 	End Method
 	End Method