@@ -54,7 +54,7 @@ def testWhenMoveBy_shouldMovePhotonByTheGivenDistanceTowardsItsDirection(self):
54
54
def testWhenScatterByTheta0_shouldNotChangePhotonDirection (self ):
55
55
phi , theta = np .pi / 4 , 0
56
56
photonResult = self ._photonFunc ("scatterBy" , phi , theta )
57
- self ._assertVectorAlmostEqual (self .INITIAL_DIRECTION , photonResult .direction )
57
+ self ._assertVectorAlmostEqual (self .INITIAL_DIRECTION , photonResult .direction , places = 6 )
58
58
59
59
def testWhenScatterByThetaPi_shouldRotatePhotonDirectionToOpposite (self ):
60
60
phi , theta = np .pi / 4 , np .pi
@@ -115,7 +115,7 @@ def testWhenRefract_shouldRefractPhoton(self):
115
115
photonResult = self ._photonFunc ("refract" , incidencePlane , angleDeflection )
116
116
117
117
expectedDirection = Vector (0 , - 1 , 0 )
118
- self ._assertVectorAlmostEqual (expectedDirection , photonResult .direction )
118
+ self ._assertVectorAlmostEqual (expectedDirection , photonResult .direction , places = 6 )
119
119
120
120
def testWhenRouletteWithWeightAboveThreshold_shouldIgnoreRoulette (self ):
121
121
weightThreshold = 1e-4
@@ -267,7 +267,7 @@ def testWhenReflectOrRefractWithRefractingIntersection_shouldRefractPhoton(self)
267
267
self .INITIAL_DIRECTION = Vector (1 , - 1 , 0 )
268
268
self .INITIAL_DIRECTION .normalize ()
269
269
insideSolidID = 9
270
- insideMaterialID = 1
270
+ insideMaterialID = 0
271
271
self ._mockFresnelIntersection (isReflected = False , incidencePlane = Vector (0 , 0 , 1 ),
272
272
angleDeflection = - np .pi / 4 , nextMaterialID = insideMaterialID ,
273
273
nextSolidID = insideSolidID )
@@ -359,9 +359,10 @@ def testWhenStepWithIntersectionReflecting_shouldMovePhotonToIntersection(self):
359
359
logger = DataPointCL (2 )
360
360
surfaces = SurfaceCL ([SurfaceCLInfo (0 , 0 , 0 , 0 , insideSolidID = 9 , outsideSolidID = 10 , toSmooth = False )])
361
361
triangles = TriangleCL ([TriangleCLInfo ([0 , 1 , 2 ], Vector (0 , 0 , 1 ))])
362
+ vertices = VertexCL ([Vertex (0 , 0 , 0 )] * 3 )
362
363
photonResult = self ._photonFunc (
363
364
"propagateStep" , stepDistance , MaterialCL ([ScatteringMaterial ()]),
364
- surfaces , triangles , VertexCL ([]) , SeedCL (1 ), logger , 0
365
+ surfaces , triangles , vertices , SeedCL (1 ), logger , 0
365
366
)
366
367
367
368
expectedPosition = self .INITIAL_POSITION + self .INITIAL_DIRECTION * intersectionDistance
@@ -376,9 +377,10 @@ def testWhenStepWithIntersectionRefracting_shouldMovePhotonToIntersection(self):
376
377
logger = DataPointCL (2 )
377
378
surfaces = SurfaceCL ([SurfaceCLInfo (0 , 0 , 0 , 0 , insideSolidID = 9 , outsideSolidID = 10 , toSmooth = False )])
378
379
triangles = TriangleCL ([TriangleCLInfo ([0 , 1 , 2 ], Vector (0 , 0 , 1 ))])
380
+ vertices = VertexCL ([Vertex (0 , 0 , 0 )] * 3 )
379
381
photonResult = self ._photonFunc (
380
382
"propagateStep" , stepDistance , MaterialCL ([ScatteringMaterial ()]),
381
- surfaces , triangles , VertexCL ([]) , SeedCL (1 ), logger , 0
383
+ surfaces , triangles , vertices , SeedCL (1 ), logger , 0
382
384
)
383
385
384
386
expectedPosition = self .INITIAL_POSITION + self .INITIAL_DIRECTION * intersectionDistance
0 commit comments