@@ -19,23 +19,23 @@ class TriangleBlock: PeggleObject {
1919 self . base = base
2020 self . height = height
2121 self . vertexOne = Point ( xCoordinate: center. xCoordinate,
22- yCoordinate: center. yCoordinate + 2 * height / 3 )
23- self . vertexTwo = Point ( xCoordinate: center. xCoordinate + base / 2 ,
24- yCoordinate: center. yCoordinate - height / 3 )
25- self . vertexThree = Point ( xCoordinate: center. xCoordinate - base / 2 ,
26- yCoordinate: center. yCoordinate - height / 3 )
22+ yCoordinate: center. yCoordinate - height / 2 )
23+ self . vertexTwo = Point ( xCoordinate: center. xCoordinate - base / 2 ,
24+ yCoordinate: center. yCoordinate + height / 2 )
25+ self . vertexThree = Point ( xCoordinate: center. xCoordinate + base / 2 ,
26+ yCoordinate: center. yCoordinate + height / 2 )
2727 super. init ( center: center)
2828 }
2929
3030 init ( id: UUID , center: Point , base: Double = 50 , height: Double = 50 ) {
3131 self . base = base
3232 self . height = height
3333 self . vertexOne = Point ( xCoordinate: center. xCoordinate,
34- yCoordinate: center. yCoordinate + 2 * height / 3 )
35- self . vertexTwo = Point ( xCoordinate: center. xCoordinate + base / 2 ,
36- yCoordinate: center. yCoordinate - height / 3 )
37- self . vertexThree = Point ( xCoordinate: center. xCoordinate - base / 2 ,
38- yCoordinate: center. yCoordinate - height / 3 )
34+ yCoordinate: center. yCoordinate - height / 2 )
35+ self . vertexTwo = Point ( xCoordinate: center. xCoordinate - base / 2 ,
36+ yCoordinate: center. yCoordinate + height / 2 )
37+ self . vertexThree = Point ( xCoordinate: center. xCoordinate + base / 2 ,
38+ yCoordinate: center. yCoordinate + height / 2 )
3939 super. init ( id: id, center: center)
4040 }
4141
@@ -66,7 +66,6 @@ class TriangleBlock: PeggleObject {
6666 let c3x = peg. center. xCoordinate - vertexThree. xCoordinate
6767 let c3y = peg. center. yCoordinate - vertexThree. yCoordinate
6868
69- // &c3sqr = radiusSqr // ; reference to radiusSqr
7069 let c3sqr = c3x * c3x + c3y * c3y - radiusSqr
7170
7271 if c3sqr <= 0 {
@@ -142,17 +141,17 @@ class TriangleBlock: PeggleObject {
142141 return false
143142 } else {
144143 // TODO: implemenation of trinagle triangle intersect
145- return false
144+ return false
146145 }
147146 }
148147
149148 override func shiftTo( location: Point ) {
150149 self . center = location
151150 self . vertexOne = Point ( xCoordinate: center. xCoordinate,
152- yCoordinate: center. yCoordinate + 2 * height / 3 )
153- self . vertexTwo = Point ( xCoordinate: center. xCoordinate + base / 2 ,
154- yCoordinate: center. yCoordinate - height / 3 )
155- self . vertexThree = Point ( xCoordinate: center. xCoordinate - base / 2 ,
156- yCoordinate: center. yCoordinate - height / 3 )
151+ yCoordinate: center. yCoordinate - height / 2 )
152+ self . vertexTwo = Point ( xCoordinate: center. xCoordinate - base / 2 ,
153+ yCoordinate: center. yCoordinate + height / 2 )
154+ self . vertexThree = Point ( xCoordinate: center. xCoordinate + base / 2 ,
155+ yCoordinate: center. yCoordinate + height / 2 )
157156 }
158157}
0 commit comments