최신 파일 자료

l4P5 (beta-003)2009-05-05 20:38
Loc (beta-005)2009-05-05 20:33
wrj4p5 (alpha-011)2009-05-05 20:41

最近の更新

2012-01-01
2010-03-25
2009-12-26
2009-05-06
2009-04-12
2009-03-02
2008-12-20
2008-08-08

Wikiガイド

サイドバー

ClassLoc - the model of 3D-Location and/or 3D-Vector

  1. /*[class] Loc 5/1/2006 by Classiclll
  2. 6/24/2006 modified
  3. 6/6/2007 Librarized.
  4. the model of geometric point with location and geometric calculations.
  5. */
  6. [members]
  7. float x, y, z;//location of 3D space.
  8. double TOL; common tolerance constant
  9. [constructer]
  10. Loc(float lx, float ly, float lz)//construct a Loc object with 3D location.
  11. Loc(Loc l) //cloninng
  12. Loc(float lng, float ltt) //construct UnitVector with Polar expression.
  13. [methods]
  14. <group #0 - Generator>
  15. static Loc newLoc(float x, float y, float z)//same as 'new Loc(x,y,z)'
  16. static Loc newPolar(float r, float lng, float ltt)
  17. //get the new Loc at (r,longitude,latitude)
  18. <group #1 - Scalar result - without Side Effect>
  19. float longitude() //get longitude of me
  20. float latitude() //get latitude of me
  21. float dist(float tx, float ty, float tz)
  22. //measure the distance to (xtx,ty,tz). (euclid distance)
  23. float dist(Loc loc) //measure the distance to loc. (euclid distance)
  24. float dist1(Loc loc) //measure the distance to loc. (manhattan distance)
  25. float dist2(Loc loc //measure square of the distance. (euclid distance)
  26. float norm() //get measure the norm of me. = sqrt(sq(x)+sq(y)+sq(z))
  27. float innerP(Loc l) //get the inner production of l, same to dot().
  28. float dot(Loc to) //dot operator, = norm(me)*norm(l)*cos(angle)
  29. float cosine(Loc l) //get cosine between l and me. = dot/(norm(me)+norm(l))
  30. float angle(Loc l) //get angle(-PI~PI) between me&l, = acos(me.cosine(l))
  31. boolean isSameGrid(Loc to) //Am "I" on the same Grid Point to "to"?
  32. boolean isEqualTo(Loc to) //Am "I" the same location to "to"?
  33. boolean isNearTo(Loc to) //Am "I" near to "to"? (based on euclid distance)
  34. boolean isNearTo(Loc to, float tol)
  35. // Am "I" near to "to"? (based on euclid distance)
  36. boolean isNear1To(Loc to)//Am "I" near to "to"? (based on manhattan distance)
  37. boolean isNear1To(Loc to, float tol)
  38. // Am "I" near to "to"? (based on manhattan distance)
  39. boolean isWithin(Loc another, float tol)
  40. // Is "another" in the range "tol" from me?(fast)
  41. String toString() //get the string expression by axis.
  42. <group #2 - Vector result - without Side Effect>
  43. Loc clone() //newLoc having same location of me
  44. Loc getPlar() //newLoc having a polar coord of me (r,lg,lt)
  45. Loc getPlarDiff(Loc to)//newLoc having a polar coord diff bet "me" to "to"
  46. Loc getPlarDiff(float dx, float dy, float dz)
  47. //newLoc having a polar coord diff
  48. Loc add(Loc off) //newLoc equl to me + ofst (elementwise - Loc ver.)
  49. Loc add(float dx, float dy, float dz)
  50. //newLoc equl to me + ofst (elementwise - float ver.)
  51. Loc sub(Loc off) //newLoc equl to me - ofst (elementwise - Loc ver.)
  52. Loc sub(float dx, float dy, float dz)
  53. //newLoc equl to me - ofst (elementwise - float ver.)
  54. Loc inv() //newLoc equl to inverse direction of me.
  55. Loc mul(float fact) //newLoc equl to scalar production of me.
  56. Loc mul(Loc fact) //newLoc equl to elementwise scalar production of me.
  57. Loc div(float fact) //newLoc equl to scalar division of me.
  58. Loc div(Loc fact) //newLoc equl to elementwise scalar division of me.
  59. Loc projection(Loc dirX, Loc dirY, Loc dirZ)
  60. //newLoc projected to the space spaned by given 3-dir's
  61. Loc outerP(Loc l) //newLoc equl to outer production, same to cross().
  62. Loc cross(Loc to) //cross operator, get newLoc orthogonal to me and l
  63. Loc unit() //newLoc equl to unit vector allong to me.( norm(v)=1 )
  64. Loc dir(Loc l) //newLoc equl to direction vector from me to Loc l.
  65. Loc ortho(Loc l) //newLoc orthogonal unit vector from l to me.
  66. Loc turned(Loc shaft, float angle)
  67. //newLoc turned arround the direction of 'shaft' vector
  68. Loc turned(float pan, float swing, float tilt)
  69. //newLoc turned to pan(Zax)->swing(Yax)->tilt(Xax).
  70. Loc turnedZ(float pan) //newLoc turned arround Zax of the World coordinate.
  71. Loc turnedY(float swing)//newLoc turned arround Yax of the World coordinate.
  72. Loc turnedX(float tilt) //newLoc turned arround Xax of the World coordinate.
  73. <group #3 - Vector result - with Self Side Effect>
  74. Loc movePolar(float r, float lng, float ltt)
  75. //move me to Polar loc at (r,longi,latti)
  76. Loc shiftPolar(float r, float lng, float ltt)
  77. //shift me to Polar dir with (r,longi,latti)
  78. Loc move(float dx, float dy, float dz)
  79. //move me to another location. (float ver.)
  80. Loc move(Loc pos) //move me to another location. (Loc ver.)
  81. Loc shift(float dx, float dy, float dz)
  82. //shift me from current to offset location.
  83. Loc shift(Loc dlt) //shift me from current to offset location.
  84. Loc scale(Loc fact) //scale me based vector.(multipled elementwise)
  85. Loc scale(float fact) //scale me based scalar.(same for each coordinates)
  86. Loc shiftI(Loc dlt) //inverse shift me from current to offset location.
  87. Loc scaleI(Loc fact) //inverse scale me based vector.(devided elementwise)
  88. Loc rotate(Loc shaft, float angle)
  89. //rotate me arround the direction of 'shaft' vector
  90. Loc rotate(float pan, float swing, float tilt)
  91. //rotate me to pan(Zax)->swing(Yax)->tilt(Xax).
  92. Loc rotateZ(float pan) //rotate me to pan(arround Z of the World coordinate).
  93. Loc rotateY(float swing)//rotate me to swing(arround Y of the World coord.).
  94. Loc rotateX(float tilt) //rotate me to tilt(arround X of the World coord.).