[Plib-cvs] plib/src/sg sg.cxx,1.32,1.33 sg.h,1.34,1.35
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2002-06-13 05:53:06
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv8045/plib/src/sg Modified Files: sg.cxx sg.h Log Message: Fixed obtuse triangle case for sgTriangleSolver_ASStoSAA and ASStoArea. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- sg.cxx 12 Jun 2002 05:45:13 -0000 1.32 +++ sg.cxx 13 Jun 2002 05:53:02 -0000 1.33 @@ -1735,11 +1735,13 @@ } -SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB ) +SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB, + int angA_is_obtuse ) { SGfloat lenC ; - sgTriangleSolver_ASStoSAA ( angB, lenA, lenB, &lenC, NULL, NULL ) ; + sgTriangleSolver_ASStoSAA ( angB, lenA, lenB, angA_is_obtuse, + &lenC, NULL, NULL ) ; return sgTriangleSolver_SAStoArea ( lenA, angB, lenC ) ; } @@ -1818,7 +1820,7 @@ if ( lenB ) *lenB = lb ; - sgTriangleSolver_SSStoAAA ( lenA, lenB, lenC, angA, NULL, angC ) ; + sgTriangleSolver_SSStoAAA ( lenA, lb, lenC, angA, NULL, angC ) ; } @@ -1847,13 +1849,18 @@ } } -void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + +void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + int angA_is_obtuse, SGfloat *lenC, SGfloat *angA, SGfloat *angC ) { /* Sine law */ SGfloat aa = (lenB == SG_ZERO ) ? SG_ZERO : sgASin (lenA * sgSin(angB)/lenB) ; + if ( angA_is_obtuse ) + aa = SG_180 - aa ; + if ( angA ) *angA = aa ; /* Find the missing angle */ @@ -1866,6 +1873,7 @@ sgTriangleSolver_SAStoASA ( lenA, cc, lenB, NULL, lenC, NULL ) ; } + void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, SGfloat *angC, SGfloat *lenB, SGfloat *lenC ) Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- sg.h 12 Jun 2002 05:45:13 -0000 1.34 +++ sg.h 13 Jun 2002 05:53:02 -0000 1.35 @@ -2573,8 +2573,9 @@ SGfloat sgTriangleSolver_ASAtoArea ( SGfloat angA, SGfloat lenB, SGfloat angC ); SGfloat sgTriangleSolver_SAStoArea ( SGfloat lenA, SGfloat angB, SGfloat lenC ); SGfloat sgTriangleSolver_SSStoArea ( SGfloat lenA, SGfloat lenB, SGfloat lenC ); -SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB ); SGfloat sgTriangleSolver_SAAtoArea ( SGfloat lenA, SGfloat angB, SGfloat angA ); +SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB, + int angA_is_obtuse ); void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, SGfloat *angA, SGfloat *angB, SGfloat *angC ) ; @@ -2582,9 +2583,11 @@ SGfloat *angA, SGfloat *lenB, SGfloat *angC ) ; void sgTriangleSolver_ASAtoSAS ( SGfloat angA, SGfloat lenB, SGfloat angC, SGfloat *lenA, SGfloat *angB, SGfloat *lenC ) ; -void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, - SGfloat *lenC, SGfloat *angA, SGfloat *angC ) ;void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, +void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, SGfloat *angC, SGfloat *lenB, SGfloat *lenC ) ; +void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + int angA_is_obtuse, + SGfloat *lenC, SGfloat *angA, SGfloat *angC ) ; SGDfloat sgdTriangleSolver_ASAtoArea(SGDfloat angA,SGDfloat lenB,SGDfloat angC); |