@@ -31,7 +31,7 @@ class Vector/*
31
31
static norm ( v : Vector ) /*
32
32
*/ {
33
33
var mag = Vector . mag ( v ) ;
34
- var div = ( mag === 0 ) ?Infinity :1.0 / mag ;
34
+ var div = ( mag === 0 ) ? Infinity :1.0 / mag ;
35
35
return Vector . times ( div , v ) ;
36
36
}
37
37
@@ -72,7 +72,7 @@ class Color/*
72
72
73
73
static toDrawingColor ( c : Color ) /*
74
74
*/ {
75
- var legalize = d => d > 1 ?1 :d ;
75
+ var legalize = d => d > 1 ? 1 :d ;
76
76
return {
77
77
r : Math . floor ( legalize ( c . r ) * 255 ) ,
78
78
g : Math . floor ( legalize ( c . g ) * 255 ) ,
@@ -295,7 +295,7 @@ class RayTracer/*
295
295
var reflectDir = Vector . minus ( d , Vector . times ( 2 , Vector . times ( Vector . dot ( normal , d ) , normal ) ) ) ;
296
296
var naturalColor = Color . plus ( Color . background ,
297
297
this . getNaturalColor ( isect . thing , pos , normal , reflectDir , scene ) ) ;
298
- var reflectedColor = ( depth >= this . maxDepth ) ?Color . grey :this . getReflectionColor ( isect . thing , pos , normal , reflectDir , scene , depth ) ;
298
+ var reflectedColor = ( depth >= this . maxDepth ) ? Color . grey :this . getReflectionColor ( isect . thing , pos , normal , reflectDir , scene , depth ) ;
299
299
return Color . plus ( naturalColor , reflectedColor ) ;
300
300
}
301
301
@@ -311,17 +311,17 @@ class RayTracer/*
311
311
var ldis = Vector . minus ( light . pos , pos ) ;
312
312
var livec = Vector . norm ( ldis ) ;
313
313
var neatIsect = this . testRay ( { start : pos , dir : livec } , scene ) ;
314
- var isInShadow = ( neatIsect === undefined ) ?false :( neatIsect <= Vector . mag ( ldis ) ) ;
314
+ var isInShadow = ( neatIsect === undefined ) ? false :( neatIsect <= Vector . mag ( ldis ) ) ;
315
315
if ( isInShadow ) /*
316
316
*/ {
317
317
return col ;
318
318
} else /*
319
319
*/ {
320
320
var illum = Vector . dot ( livec , norm ) ;
321
- var lcolor = ( illum > 0 ) ?Color . scale ( illum , light . color )
321
+ var lcolor = ( illum > 0 ) ? Color . scale ( illum , light . color )
322
322
:Color . defaultColor ;
323
323
var specular = Vector . dot ( livec , Vector . norm ( rd ) ) ;
324
- var scolor = ( specular > 0 ) ?Color . scale ( Math . pow ( specular , thing . surface . roughness ) , light . color )
324
+ var scolor = ( specular > 0 ) ? Color . scale ( Math . pow ( specular , thing . surface . roughness ) , light . color )
325
325
:Color . defaultColor ;
326
326
return Color . plus ( col , Color . plus ( Color . times ( thing . surface . diffuse ( pos ) , lcolor ) ,
327
327
Color . times ( thing . surface . specular ( pos ) , scolor ) ) ) ;
0 commit comments