 bool czm_pointInEllipsoid(czm_ellipsoid ellipsoid, vec3 point)
 {
     // TODO: Take into account ellipsoid's center; optimize with radii-squared; and move elsewhere
+/*
     return (((point.x * point.x) / (ellipsoid.radii.x * ellipsoid.radii.x)) +
             ((point.y * point.y) / (ellipsoid.radii.y * ellipsoid.radii.y)) +
             ((point.z * point.z) / (ellipsoid.radii.z * ellipsoid.radii.z)) < 1.0);
+*/
+
+    return (((point.x * point.x) / (6378137.0 * 6378137.0)) +
+            ((point.y * point.y) / (6378137.0 * 6378137.0)) +
+            ((point.z * point.z) / (6356752.314245 * 6356752.314245)) < 1.0);
 }
 
 void main()

	    // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.
	    if (czm_pointInEllipsoid(ellipsoid, v_positionWC))
	    {
            discard;
	    }
	
	    // Discard if in the sensor's shadow
	    if (inSensorShadow(sensorVertexWC, ellipsoid, v_positionEC))
	    {
	        discard;
	    }
    }
    
    // Discard if not in the sensor's sphere
    // PERFORMANCE_IDEA: We can omit this check if the radius is Number.POSITIVE_INFINITY.
    if (distance(v_positionEC, sensorVertexEC) > u_sensorRadius)
    {
        discard;
    }

    czm_ray ray = czm_ray(vec3(0.0), normalize(v_positionEC));  // Ray from eye to fragment in eye coordinates
    czm_raySegment ellipsoidInterval = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);

    materialInput.normalEC = normalEC;
    
    czm_material material = czm_getMaterial(materialInput);
    return czm_phong(normalize(positionToEyeEC), material);
}

#endif
