MCPcopy Create free account
hub / github.com/cinder/Cinder / calcProjectedArea

Method calcProjectedArea

src/cinder/Sphere.cpp:241–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241float Sphere::calcProjectedArea( float focalLength, vec2 screenSizePixels ) const
242{
243 vec3 o( mCenter );
244
245 float r2 = mRadius * mRadius;
246 float z2 = o.z * o.z;
247 float l2 = dot( o, o );
248
249 float area = -float( M_PI ) * focalLength * focalLength * r2 * sqrt( fabs((l2-r2)/(r2-z2)) ) / (r2-z2);
250 float aspectRatio = screenSizePixels.x / screenSizePixels.y;
251 return area * screenSizePixels.x * screenSizePixels.y * 0.25f / aspectRatio;
252}
253
254Sphere Sphere::transformed( const mat4 &transform ) const
255{

Callers 1

calcScreenAreaMethod · 0.80

Calls 2

dotFunction · 0.85
sqrtFunction · 0.85

Tested by

no test coverage detected