

Public Member Functions | |
| CloseStarPicker (const UniversalCoord &pos, const Vec3f &dir, double t, float _maxDistance, float angle) | |
| void | process (const Star &star, float distance, float appMag) |
| ~CloseStarPicker () | |
Public Attributes | |
| float | closestDistance |
| const Star * | closestStar |
| float | maxDistance |
| double | now |
| Vec3f | pickDir |
| UniversalCoord | pickOrigin |
| double | sinAngle2Closest |
|
||||||||||||||||||||||||
|
Definition at line 596 of file universe.cpp. References ANGULAR_RES, and sin(). 00600 : 00601 pickOrigin(pos), 00602 pickDir(dir), 00603 now(t), 00604 maxDistance(_maxDistance), 00605 closestStar(NULL), 00606 closestDistance(0.0f), 00607 sinAngle2Closest(sin(angle/2.0) > ANGULAR_RES ? sin(angle/2.0) : 00608 ANGULAR_RES ) 00609 { 00610 }
|
|
|
Definition at line 582 of file universe.cpp. 00582 {};
|
|
||||||||||||||||
|
Implements OctreeProcessor< Star, float >. Definition at line 612 of file universe.cpp. References ANGULAR_RES, closestDistance, closestStar, distance(), maxDistance, astro::microLightYearsToKilometers(), now, pickDir, pickOrigin, sinAngle2Closest, sqrt(), testIntersection(), Vector3< T >::x, Vector3< T >::y, and Vector3< T >::z. 00615 {
00616 if (lowPrecDistance > maxDistance)
00617 return;
00618
00619 Vec3d hPos = (star.getPosition(now) - pickOrigin) *
00620 astro::microLightYearsToKilometers(1.0);
00621 Vec3f starDir((float) hPos.x, (float) hPos.y, (float) hPos.z);
00622 float distance = 0.0f;
00623
00624 if (testIntersection(Ray3f(Point3f(0, 0, 0), pickDir),
00625 Spheref(Point3f(starDir.x, starDir.y, starDir.z),
00626 star.getRadius()), distance))
00627 {
00628 if (distance > 0.0f)
00629 {
00630 if (closestStar == NULL || distance < closestDistance)
00631 {
00632 closestStar = ☆
00633 closestDistance = starDir.length();
00634 sinAngle2Closest = ANGULAR_RES;
00635 // An exact hit--set the angle to "zero"
00636 }
00637 }
00638 }
00639 else
00640 {
00641 // We don't have an exact hit; check to see if we're close enough
00642 float distance = starDir.length();
00643 starDir.normalize();
00644 Vec3f starMiss = starDir - pickDir;
00645 Vec3d sMd = Vec3d(starMiss.x, starMiss.y, starMiss.z );
00646
00647 double sinAngle2 = sqrt(sMd * sMd)/2.0;
00648
00649 if (sinAngle2 <= sinAngle2Closest &&
00650 (closestStar == NULL || distance < closestDistance))
00651 {
00652 closestStar = ☆
00653 closestDistance = distance;
00654 sinAngle2Closest = sinAngle2 > ANGULAR_RES ? sinAngle2 : ANGULAR_RES;
00655 }
00656 }
00657 }
|
|
|
Definition at line 591 of file universe.cpp. Referenced by process(). |
|
|
Definition at line 590 of file universe.cpp. Referenced by Universe::pickStar(), and process(). |
|
|
Definition at line 589 of file universe.cpp. Referenced by process(). |
|
|
Definition at line 588 of file universe.cpp. Referenced by process(). |
|
|
Definition at line 587 of file universe.cpp. Referenced by process(). |
|
|
Definition at line 586 of file universe.cpp. Referenced by process(). |
|
|
Definition at line 592 of file universe.cpp. Referenced by process(). |
1.4.1