upload 2011-07-10
XYGraph v2.3 - web page graph
☜☞
donate
get code
This file is personal home work. No one
proofread. Cannot promise correctness.
If you suspect any view point wrong,
please ask a math expert near by.
Freeman 2009-06-19-10-46
Please use MSIE browser to read this file.
Did not test other browser. This file is
written under MSIE 6.0
<a name="HanLing">
2011-07-09-14-38 start
On 2011-07-03-18-33 done upload
tute0055.htm to freeman2.com/
on 2011-07-03-18-33 access
http://freeman2.com/freeman2.htm
has rocsitee.js message.
on 2011-07-03-18-35 receive
http://freeman2.com/tute0055.htm
page show up, but message in
rocsitee.js do not show up.
Refresh page several times,
same, all rocsitee.js message
not present.
on 2011-07-03-21-02 access
http://freeman2.com/tute0043.htm
get page, but
still no rocsitee.js message.
2011-07-09-14-30 decide put
message at sphtrian.htm ["QADraw"]
2011-07-09-14-45 stop
<a name="docA_001">
2011-07-05-19-10 始 a007051910
This file sphtrian.htm has a
function eyeUpMat(arg1,arg2,arg3)
Following explain how it works.
Input arguments are arg1,arg2,arg3
eyeUpMat() read two vectors arg1,
arg2 and property of vectors arg3
eyeUpMat() build a rotation matrix
from three input data.
<a name="docA_002">
arg1 define a vector, which is a
coordinate axis vector for
the rotated system.
arg1 define an accurate direction
arg1 vector components is measured
from ground coordinate system.
arg2 define a vector, which is in
a coordinate plane of the
rotated system.
arg2 define an approximate direction
arg2 vector components is measured
from ground coordinate system.
arg3 regulate arg1,arg2 to be which
coordinate in rotated system.
eyeUpMat() output a rotation matrix
from user given data.
<a name="docA_003">
Avoid vector length to be a factor,
Require vector a (arg1) length=1
Require vector b (arg2) length=1
Require vector a be accurate.
Require vector b be approximate.
therefore, vector
a=[a1,a2,a3] ---eqn.sph001
is one column in rotation matrix
[a1,a2,a3] is column one? or two?
or three? this is determined by
arg3.
<a name="docA_004">
Vector b is approximate direction
b=[b1,b2,b3] ---eqn.sph002
do not show up in rotation matrix.
Assume vector a cross vector b get
vector f
f=[f1,f2,f3] ---eqn.sph003
<a name="docA_005">
f=[f1,f2,f3]
=[a1,a2,a3]×[b1,b2,b3]
= ---eqn.sph004
[ i j k ]
[ a1 a2 a3 ]
[ b1 b2 b3 ]
=
[a2b3-a3b2,
a3b1-a1b3,
a1b2-a2b1]
=[f1,f2,f3]
<a name="docA_006">
f1=a2b3-a3b2 ---eqn.sph005
f2=a3b1-a1b3 ---eqn.sph006
f3=a1b2-a2b1 ---eqn.sph007
<a name="docA_007">
Vector a and vector b not required
to be perpendicular to each other.
Human brain estimation is hard to
be exact perpendicular.
Vector f perpendicular to vector a.
Vector f perpendicular to vector b.
Above two are perpendicular exactly
because vector is created by math
calculation.
[f1,f2,f3]= ---eqn.sph004
[a1,a2,a3]×[b1,b2,b3]
<a name="docA_008">
But! vector f length is not one,
because vector a and vector b are
not perpendicular. Normalize vector
f, let result be vector g
g=[g1,g2,g3] ---eqn.sph008
=[f1,f2,f3]/|f|
In which
|f|= ---eqn.sph009
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
<a name="docA_009">
Express g with given values
[a1,a2,a3] and [b1,b2,b3], get
g1=(a2b3-a3b2)/ ---eqn.sph010
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
g2=(a3b1-a1b3)/ ---eqn.sph011
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
g3=(a1b2-a2b1)/ ---eqn.sph012
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
Normalized vector g length is one.
<a name="docA_010">
Because vector g ⊥ vector a
Because vector g ⊥ vector b
plus g length be one, therefore
[g1,g2,g3] is one column in rotation
matrix. It is column one? or two?
or three? this is determined by
arg3.
Now vector a and vector g are
perpendicular and both length
be one. The following find the
result of vector a × vector g
<a name="docA_011">
h=[h1,h2,h3]
=[a1,a2,a3] × [g1,g2,g3]
= ---eqn.sph013
[ i j k ]
[ a1 a2 a3 ]
[ g1 g2 g3 ]
=
[a2g3-a3g2,
a3g1-a1g3,
a1g2-a2g1]
=[h1,h2,h3]
<a name="docA_012">
h1=a2g3-a3g2 ---eqn.sph014
h2=a3g1-a1g3 ---eqn.sph015
h3=a1g2-a2g1 ---eqn.sph016
Above is h=a×g ---eqn.sph013
Some case need vector a × vector g
Some case need vector g × vector a
<a name="docA_013">
Following is m=g×a ---eqn.sph017
m=[m1,m2,m3]
=[g1,g2,g3] × [a1,a2,a3]
= ---eqn.sph017
[ i j k ]
[ g1 g2 g3 ]
[ a1 a2 a3 ]
=
[-a2g3+a3g2,
-a3g1+a1g3,
-a1g2+a2g1]
=[m1,m2,m3]
<a name="docA_014">
m1=-a2g3+a3g2 ---eqn.sph018
m2=-a3g1+a1g3 ---eqn.sph019
m3=-a1g2+a2g1 ---eqn.sph020
Use given data [a1,a2,a3] and [b1,b2,b3]
to express m=[m1,m2,m3] as following
m1=-a2(a1b2-a2b1)/ ---eqn.sph021
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
+a3(a3b1-a1b3)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
m2=-a3(a2b3-a3b2)/ ---eqn.sph022
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
+a1(a1b2-a2b1)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
m3=-a1(a3b1-a1b3)/ ---eqn.sph023
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
+a2(a2b3-a3b2)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
<a name="docA_015">
Use given data [a1,a2,a3] and [b1,b2,b3]
to express h=[h1,h2,h3] as following
h1=a2(a1b2-a2b1)/ ---eqn.sph024
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
-a3(a3b1-a1b3)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
h2=a3(a2b3-a3b2)/ ---eqn.sph025
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
-a1(a1b2-a2b1)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
h3=a1(a3b1-a1b3)/ ---eqn.sph026
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
-a2(a2b3-a3b2)/
sqrt((a2b3-a3b2)*(a2b3-a3b2)
+(a3b1-a1b3)*(a3b1-a1b3)
+(a1b2-a2b1)*(a1b2-a2b1))
<a name="docA_016">
Above dropped multiplication "*"
Below add multiplication "*",
Because to verify equation, must
include "*"
m1=-a2*(a1*b2-a2*b1)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))+a3*(a3*b1-a1*b3)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph027
m2=-a3*(a2*b3-a3*b2)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))+a1*(a1*b2-a2*b1)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph028
m3=-a1*(a3*b1-a1*b3)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))+a2*(a2*b3-a3*b2)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph029
<a name="docA_017">
h1=+a2*(a1*b2-a2*b1)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))-a3*(a3*b1-a1*b3)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph030
h2=+a3*(a2*b3-a3*b2)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))-a1*(a1*b2-a2*b1)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph031
h3=+a1*(a3*b1-a1*b3)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))-a2*(a2*b3-a3*b2)/sqrt((a2*b3-a3*b2)*(a2*b3-a3*b2)+(a3*b1-a1*b3)*(a3*b1-a1*b3)+(a1*b2-a2*b1)*(a1*b2-a2*b1))
---eqn.sph032
[m1,m2,m3] or [h1,h2,h3] be one
column in a rotation matrix.
[m1,m2,m3] or [h1,h2,h3] is
column one? or two? or three?
this is determined by arg3.
<a name="docA_018">
positive x=y×z , y=z×x , z=x×y ---eqn.sph033
negative x=-z×y, y=-x×z, z=-y×x ---eqn.sph034
h=[h1,h2,h3] ---eqn.sph013
=[a1,a2,a3] × [g1,g2,g3] ; h=a×g
m=[m1,m2,m3] ---eqn.sph017
=[g1,g2,g3] × [a1,a2,a3] ; m=g×a
<a name="docA_019">The following determine column order
If arg3='zx' or arg3=6
Assign accurate a=[a1,a2,a3] be z axis
Approximate b=[b1,b2,b3] define x axis.
(vector b is not x axis, b define x)
[m1,m2,m3] or [h1,h2,h3]
first : be one column in matrix
second: replace vector b=[b1,b2,b3]
third : be x axis in rotated system.
<a name="docA_020">
vector g ⊥ vector a (z axis)
vector g ⊥ vector b (x axis)
therefore y axis = vector g =[g1,g2,g3]
Determine rotated system x axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+z×y
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+y×z
=[g1,g2,g3] × [a1,a2,a3]
drop h,because x=-z×y sign opposite
use m,because x=y×z sign consistent
assign m be x
code line: rot1=eyeUpMat(ptA,ptB,'zx');
rot.Mat is [m col.,g col.,a col.]
2011-06-19-19-23 here
=====
<a name="docA_021">
If arg3='zy' or arg3=5
Assign accurate a=[a1,a2,a3] be z axis.
Approximate b=[b1,b2,b3] define y axis
[m1,m2,m3] or [h1,h2,h3] be y axis
vector g ⊥ vector a (z axis)
vector g ⊥ vector b (y axis)
therefore x axis = vector g =[g1,g2,g3]
<a name="docA_022">
Determine rotated system y axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+z×x
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+x×z
=[g1,g2,g3] × [a1,a2,a3]
use h, since y=z×x sign consistent
drop m, since y=-x×z sign opposite
code line: rot1=eyeUpMat(ptA,ptB,'zy');
rot.Mat is [g col., h col., a col.]
2011-06-19-19-50 here
=====
<a name="docA_023">
If arg3='yx' or arg3=3
Assign accurate a=[a1,a2,a3] be y axis
Approximate b=[b1,b2,b3] define x axis
[m1,m2,m3] or [h1,h2,h3] be x axis
vector g ⊥ vector a (y axis)
vector g ⊥ vector b (x axis)
therefore z axis = vector g =[g1,g2,g3]
<a name="docA_024">
Determine rotated system x axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+y×z
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+z×y
=[g1,g2,g3] × [a1,a2,a3]
use h, since x=+y×z sign consistent
drop m, since x=-y×z sign opposite
code line: rot1=eyeUpMat(ptA,ptB,'yx');
rot.Mat is [h col., a col., g col.]
2011-06-19-19-54 here
=====
<a name="docA_025">
If arg3='yz' or arg3=4
Assign accurate a=[a1,a2,a3] be y axis
Approximate b=[b1,b2,b3] define z axis
[m1,m2,m3] or [h1,h2,h3] be z axis
vector g ⊥ vector a (y axis)
vector g ⊥ vector b (z axis)
therefore x axis = vector g =[g1,g2,g3]
<a name="docA_026">
Determine rotated system z axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+y×x
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+x×y
=[g1,g2,g3] × [a1,a2,a3]
drop h,because z=-y×x sign opposite
use m,because z=+x×y sign consistent
code line: rot1=eyeUpMat(ptA,ptB,'yz');
rot.Mat is [g col., a col., m col.]
2011-06-19-19-57 here
=====
<a name="docA_027">
If arg3='xy' or arg3=2
Assign accurate a=[a1,a2,a3] be x axis
Approximate b=[b1,b2,b3] define y axis
[m1,m2,m3] or [h1,h2,h3] be y axis
vector g ⊥ vector a (x axis)
vector g ⊥ vector b (y axis)
therefore z axis = vector g =[g1,g2,g3]
<a name="docA_028">
Determine rotated system y axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+x×z
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+z×x
=[g1,g2,g3] × [a1,a2,a3]
drop h,because y=-x×z sign opposite
use m,because y=+z×x sign consistent
code line: rot1=eyeUpMat(ptA,ptB,'xy');
rot.Mat is [a col., m col., g col.]
2011-06-19-20-08 here
=====
<a name="docA_029">
If arg3='xz' or arg3=1
Assign accurate a=[a1,a2,a3] be x axis
Approximate b=[b1,b2,b3] define z axis
[m1,m2,m3] or [h1,h2,h3] be z axis
vector g ⊥ vector a (x axis)
vector g ⊥ vector b (z axis)
therefore y axis = vector g =[g1,g2,g3]
<a name="docA_030">
Determine rotated system z axis:
x=y×z , y=z×x , z=x×y
x=-z×y, y=-x×z, z=-y×x
h=[h1,h2,h3]=+x×y
=[a1,a2,a3] × [g1,g2,g3]
m=[m1,m2,m3]=+y×x
=[g1,g2,g3] × [a1,a2,a3]
use h, since z=+x×y sign consistent
drop m, since z=-y×x sign opposite
code line: rot1=eyeUpMat(ptA,ptB,'xz');
rot.Mat is [a col., g col., h col.]
2011-06-19-20-10 here
2011-07-05-20-53 stop a007052053
<a name="docA_031">
2011-07-05-22-50 start
Above has six different rotation
matrix, list them below
zx rot.Mat is [m col., g col., a col.] ---eqn.sph035
zy rot.Mat is [g col., h col., a col.] ---eqn.sph036
yx rot.Mat is [h col., a col., g col.] ---eqn.sph037
yz rot.Mat is [g col., a col., m col.] ---eqn.sph038
xy rot.Mat is [a col., m col., g col.] ---eqn.sph039
xz rot.Mat is [a col., g col., h col.] ---eqn.sph040
Although six look different, but
view from another point, they are
all the SAME, that is
<a name="docA_032">Rot.Mat must be [x col., y col., z col.] ---eqn.sph041
Rotated coordinate system is also
called bird body coordinate system.
It is used in Liu,Hsinhan page only.
If measured from ground coordinate
system, bird body coordinate x axis
is x=[x1,x2,x3] ---eqn.sph042
If measured from ground coordinate
system, bird body coordinate y axis
is y=[y1,y2,y3] ---eqn.sph043
If measured from ground coordinate
system, bird body coordinate z axis
is z=[z1,z2,z3] ---eqn.sph044
<a name="docA_033">
Rotation matrix has the following
form
[x1 y1 z1]
[x2 y2 z2] ---eqn.sph045
[x3 y3 z3]
This definition, change a point
measured
in bird body coordinate [Bx,By,Bz]
to ground coordinate [Gx,Gy,Gz]
That is
[Gx] [x1 y1 z1] [Bx]
[Gy]=[x2 y2 z2]*[By] ---eqn.sph046
[Gz] [x3 y3 z3] [Bz]
<a name="docA_034">
It is easy to verify, for example
measured in bird body system
Bp=[1,0,0] ---eqn.sph047
convert to ground use next equation
[Gx] [x1 y1 z1] [1]
[Gy]=[x2 y2 z2]*[0] ---eqn.sph048
[Gz] [x3 y3 z3] [0]
that is
[Gx] [x1*1 + y1*0 + z1*0]
[Gy]=[x2*1 + y2*0 + z2*0] ---eqn.sph049
[Gz] [x3*1 + y3*0 + z3*0]
<a name="docA_035">
that is
[Gx] [x1]
[Gy]=[x2] ---eqn.sph050
[Gz] [x3]
This is perfect right, since rotation
matrix column one is defined to be
bird body [1,0,0] measured at ground
coordinate system.
If bird Bp=[3,0,0], answer increase
or decrease in proportion.
<a name="docA_036">
If Bp=[0,1,0],or Bp=[0,4,0],
If Bp=[0,0,1],or Bp=[0,0,5],
the analysis is the same. Then a
bird point Bp=[3,4,5] transform
to ground coordinate system is
easy to understand.
<a name="docA_037">
Many application need to convert
from ground to bird. In this case
transpose the rotation matrix
[x1 y1 z1]
[x2 y2 z2] ---eqn.sph045
[x3 y3 z3]
to next form
[x1 x2 x3]
[y1 y2 y3] ---eqn.sph051
[z1 z2 z3]
then
[Bx] [x1 x2 x3] [Gx]
[By]=[y1 y2 y3]*[Gy] ---eqn.sph052
[Bz] [z1 z2 z3] [Gz]
is correct equation.
<a name="docA_038">
Why arrange
x=[x1,x2,x3]
y=[y1,y2,y3]
z=[z1,z2,z3]
to
[x1 y1 z1]
[x2 y2 z2] ---eqn.sph045
[x3 y3 z3]
the result is a rotation matrix?
Please see rotate3d.htm or local.
2011-07-05-23-26 stop
<"QADraw">
Spherical triangle graph page
Hsinhan wait for wife Liling
until last breath !!!!!
鑫漢永遠等候愛妻麗玲, 至死為止
why put here?
2011-07-09-14-30
Please use MSIE browser to read this file
Graph area size, W:
H:
x min:
, x max:
; y min:
, y max:
;
x,y value below should be within range above
Sph.triangle abc, given a,b and angle a & b; c is unknown.
vector a≡l,b≡m,p=l×m have auxiliary vector l*,m*,p*.
l,m,p all given, see
tute0055.htm eqn.rod136 to 139.
Draw l*,m*,p* or not ?
not draw
l*,m*,p*
l*,m*,p* length may be>1. Please increase x/y range.
If draw l*,m*,p* click "Draw triangle AB side & angle"
or click "reverse". If click "Draw triangle ABC sides"
program ignore l*,m*,p* and not draw them.
l*,m*,p* color=
, width=
, solidot=
ground
(fixed) 3D triad
color=
, width=
, solidot=
recover default color/width/solidot click
cws
b,c color=
, width=
, solidot=
c,a color=
, width=
, solidot=
a,b color=
, width=
, solidot=
a,b,c color=
, width=
, solidot=
triangle color=
, width=
, solidot=
tangent color=
, width=
, solidot=
Draw two tangent at vertex A▲
; B◆
; C●
Axes cross at x=
, y=
,
;
Next five boxes convert φ,θ,ρ to x,y,z use degree.
Three numbers are latitude,longitude,radius.
Equator is latitude=0. If click south/north be ▣ polar
latitude place read as polar angle. North pole=0.
If fill in just two numbers, program set radius=1.
"I" is eye ; "U" is up ; "A" is vertex A
;
;
,
south/north be
latitude
Program do not read above five boxes, read only box below
View triangle at center:
eye xyz
Up xyz
Click R, Record data to box17, auto ▣light;
Click A, Apply box17 data;
Click D, Delete box17 data, auto □light;
Save box17 data to your file for future use.
;
; recordlight
A,B,C is spherical triangle three vertex vectors.
Given A,B (but not C) and angle A,B fill in next four boxes
angle must be degree, program do not cut angle to half.
angle:
; angle:
Given A,B,C (but not angles), fill in next three boxes
A:
; B:
C:
A,B,C length will be normalized.
QADraw
;
;
Please use MSIE browser to read this file
Box11, output XYGraph code
<a name="docB_001">
2011-07-06-14-11 start
This file sphtrian.htm is a utility
to draw spherical triangle. It was
a big file, include this file QADraw
and tute0055.htm QBDraw, QCDraw and
QDDraw. Because file size exceed
500MBytes, decide to split to two
files tute0055.htm and sphtrian.htm
sphtrian has link with tute0055.
<a name="docB_002">
Following is QADraw control panel
[[link
Spherical triangle graph page
Graph area size, W:[ ] H:[ ]
x min:[ ], x max:[ ]; y min:[ ], y max:[ ];
x,y value below should be within range above
]]
Above control drawing board
dimension and x/y min/max range.
Click or program update
x/y min/max range. If need other
range, change by hand.
<a name="docB_003">
[[link
Sph.triangle abc, given a,b and angle a & b; c is unknown.
vector a≡l,b≡m,p=l×m have auxiliary vector l*,m*,p*.
l,m,p all given, see tute0055.htm eqn.rod136 to 139.
Draw l*,m*,p* or not ? □not draw l*,m*,p*
l*,m*,p* length may be>1. Please increase x/y range.
If draw l*,m*,p* click "Draw triangle AB side & angle"
or click "reverse". If click "Draw triangle ABC sides"
program ignore l*,m*,p* and not draw them.
l*,m*,p*color=[ ], width=[ ], solidot=[ ]
]]
<a name="docB_004">
Vectors a≡l,b≡m,p=l×m are given.
Their auxiliary vectors are
l*,m*,p* Code to draw auxiliary
was added after upload tute0055
mainly Liu,Hsinhan hope to know
the relative location between
given l,m,p and unknown l*,m*,p*
Default □not draw l*,m*,p* If
click ▣yes draw l*,m*,p* and if
triangle area is too small, in
this case aux. vectors length
are greater than x/y [-1,+1]
Please click , see whether
help, if not, hand adjust
x/y min/max range.
<a name="docB_005">
If given three vertex vectors
of a triangle or if given two
vertex vectors and two vertex
angles, both define a triangle.
This file has two input methods
First input three vertex vectors
click button is
Second input two vertex vectors
and two vertex angles. Click
button is and
<a name="docB_006">
First input method has no thing
to do with proving Euler's
rotation theorem.
Second input method relate to
proving Euler's rotation theorem.
Aux. vectors l*,m*,p* is used in
proving Euler's theorem. If click
▣yes draw l*,m*,p* and if click
[Draw triangle ABC sides] user
will not see l*,m*,p* graph.
Because program not care l*,m*,p*
In this case, click
[Draw triangle AB side & angle]
or [reverse] to get l*,m*,p* graph.
<a name="docB_007">
l*,m*,p* color=[ ], width=[ ], solidot=[ ]
determine aux. l*,m*,p* line
color/width/solidot property.
OA draw ▲,OB draw ◆,OC draw ●.
l* draw ▲,m* draw ◆,p* draw ×.
p* not relate to OC, therefore
p* not draw ●.
Liu,Hsinhan think the need of
drawing aux. l*,m*,p* is minimum,
and put its control box far away
from drawing board.
2011-07-06-15-03 write note here
2011-07-09-22-17 translate here
<a name="docB_008">
[[link
ground (fixed) 3D triad
color=[ ], width=[ ], solidot=[ ]
recover default color/width/solidot click CWS
]]
Let user decide ground triad
color/width/solidot.
<a name="docB_009">
[[link
b,c color=[ ], width=[ ], solidot=[ ]
c,a color=[ ], width=[ ], solidot=[ ]
a,b color=[ ], width=[ ], solidot=[ ]
a,b,c color=[ ], width=[ ], solidot=[ ]
triangle color=[ ], width=[ ], solidot=[ ]
]]
[b,c] indicate great circle pass
vector b and c. Above boxes let
user assign three great circle
color/width/solidot and three
radius OA,OB,OC and triangle ABC
color/width/solidot.
<a name="docB_010">
[[link
tangent color=[ ], width=[ ], solidot=[ ]
Draw two tangent at vertex A▲□; B◆□; C●□
]]
Let user assign vertex two
tangents color/width/solidot.
To prove spherical triangle
cosine law need vertex two
tangents. Please see tute0055
QCDraw
If click A▲▣; B◆□; C●□
Only vertex A draw tangents.
If click A▲▣; B◆▣; C●▣
Three vertex A,B,C all draw
tangents. Program did not stop
user from choosing multiple
vertex. Default draw none.
<a name="docB_011">
[[link
Axes cross at x=[ ], y=[ ], 2 0 ;□Del x,y axis
]]
To draw spherical triangle, not
need x,y coordinates.
Default: □Del x,y axis
If click ▣Use x,y axis then
"Axes cross at x=[ ], y=[ ]"
is effective. Most case set at
x=0, y=0. But if graph range
is x/y = 10/20, in this case
set at x=15, y=15. If not, the
range x/y = 10/20 become
x/y = 0/20. Because XYGraph
insist to display axes cross
point on display.
2011-07-06-15-50 here
<a name="docB_012">
[[link
Next five boxes convert φ,θ,ρ to x,y,z use degree.
Three numbers are latitude,longitude,radius.
Equator is latitude=0. If click south/north be ▣ polar
latitude place read as polar angle. North pole=0.
If fill in just two numbers, program set radius=1.
"I" is eye ; "U" is up ; "A" is vertex A
;
;
,
south/north be
latitude
Program do not read above five boxes, read only box below
]]
Program require input to be (x,y,z).
If user has latitude/longitude in
hand, fill data to above boxes
(choose a right one) Click right
side button to convert.
<a name="docB_013">
[[link
View triangle at center: build data after 1st draw
eye xyz
Up xyz
]]
Draw 3D object on 2D monitor,
must assign eye location and
screen up direction. Fill eye
and up data to above boxes.
If eye is at side of triangle
it is hard to compare three
angles relative magnitude.
When draw first time, program
calculate triangle center x,y,z
<a name="docB_014">
View triangle at center: build data after 1st draw
and change above to next
View triangle at center: 0.506,0.61,0.539
Now click program read [center
x,y,z] and fill to eye xyz box.
Draw second time, eye is on
center view. See relative angle
better. Two input methods:
1: given vertex A,B,C. It is
possible to calculate center
x,y,z without first run.
2: given vertex A,B and angle
A,B. It is not possible to
calculate center x,y,z without
first run.
This program is designed after
first draw get center x,y,z.
<a name="docB_015">
[[link
Click R, Record data to box17, auto ▣light;
Click A, Apply box17 data;
Click D, Delete box17 data, auto □light;
Save box17 data to your file for future use.
;
; record
light
]]
<a name="docB_016">
After created QBDraw,QCDraw,
Liu,Hsinhan hope to find their
original 3D data, but not keep
and disappear. Then added new
buttons for future work
archive useful 3D data. If user
satisfy a graph output, click
to Record all 3D data to Box17.
User goto box17 to copy and save
data for future re-use.
<a name="docB_017">
When re-draw, copy 3D data and
paste to Box17, then click to
Apply data to right input boxes,
click [Draw triangle ABC sides]
or Draw triangle AB side & angle]
or [reverse] to get old graph.
If click , light become [▣light]
If click , light become [□light]
indicate whether Box17 has data.
If click [□light] program goto
Box17 and see if there is data
or not, then update light.
<a name="docB_018">
[[link
A,B,C is spherical triangle three vertex vectors.
Given A,B (but not C) and angle A,B fill in next four boxes
angle must be degree, program do not cut angle to half.
angle: ; angle:
Given A,B,C (but not angles), fill in next three boxes
A: ; B:
C: A,B,C length will be normalized
QADraw ; ;
[ drawing board is here ]
]]
<a name="docB_019">
2011-07-06-16-32 here
Above is QADraw main input boxes.
If know triangle A,B,C three
vectors, fill them to A,B,C
three boxes.
If know triangle A,B two vectors
and A,B two angles, fill them to
A,B vector and angle four boxes.
Angle box must use degree, not
radian, and must not rotation
angle full angles. User divide
rotation angle by two.
2011-07-06-16-37 stop
<a name="docB_020">
2011-07-06-18-06 start
Program will not divide rotation
angle by two. If program does,
then all non-rotation user must
multiply vertex angle by two
before fill in values.
Rotation user fill in half angle
in degree.
If click program run
qC=quatquat(qA,qB);
If click program run
qC=quatquat(qB,qA);
"reverse" say
quaternion multiplication
qA*qB reverse to qB*qA.
<a name="docB_021">
Related code is next
function drawSphereTriangle()
{
.....
if(arguments.length==4)
qC=quatquat(qA,qB); //a006161606
else
qC=quatquat(qB,qA); //a006171855
.....
}
<a name="docB_022">
[[link
Box11, output XYGraph code
]]
Box11, output XYGraph code. On
the other hand XYGraph code in
Box11 can be tested by click
.
<a name="docB_023">
If hope to display original
triangle and dual triangle at
same time. Run original once,
keep its XYGraph code. Then
run dual once, box11 has dual
code. Now paste original code
to end of (or begin of) box11.
With two codes in one box,
click
output both triangles.
<a name="docB_024">
[[link
Box12, output 2D x,y data
Box13, output 3D x,y,z data
Box14, vector,angle,area,normal
Box15, rotation matrix
]]
<a name="docB_025">
Box12 to Box15 output function
are marked above each box. In
which [normal] may be useful.
Draw triangle vertex tangent
lines, with arbitrary eye xyz
it is not easy to see the right
angle between tangent & radius.
Run [Draw triangle ABC sides]
Box14 output normal vectors.
Choose a right normal and paste
to eye xyz box. Run second time
to see the right angle better.
But view triangle from side,
expect to see triangle thin as
a paper side view.
2011-07-06-18-56 stop
<a name="docB_026">
2011-07-06-19-56 start
[[link
]]
Above buttons main function is
debug program functions.
<a name="docB_027">
test function eyeUpMat()
This file top has document.
Please click Box15 build
examples. Then click
output to Box16.
test function transpoMat()
Please click Box15 has example
input, then click Output to
Box16.
<a name="docB_028">
Based on original vertex,
create dual triangle vertex.
Original triangle vertex come from
Box15. Please click for example,
or click to read A,B,C input
box values at top of drawing board.
Each dual vector has +/- choices.
Three dual vectors have 2*2*2=8
choices. Select one in
○1,○2,○3,○4,○5,○6,○7,○8
<a name="docB_029">
then click , click to ABC box.
Finally click This draw
has only dual triangle. If dual
and original can not form "◎"
which is one inside the other.
Return to
○1,○2,○3,○4,○5,○6,○7,○8
try another one.
2011-07-06-20-36 here
<a name="docB_030">
[[link
Box16, debug ;
Box17, record, apply ;
QAboxc17.value='string'
]]
When test need .
[Box17, record, apply] already
explained earlier.
<a name="docB_031">
and is a set.
Original ∆ABC and dual ∆LMN
have total six vertex vectors.
∆ABC has a,b,c and ∆LMN has
x,y,z.
<a name="docB_032">
When draw semilunar triangle,
a perpendicular to which two
of x,y,z?
b perpendicular to which two
of x,y,z?
c perpendicular to which two
of x,y,z? Not certain.
Copy a,b,c and x,y,z six vectors
to Box16, or click to use
example, then click
<a name="docB_033">
Answer output to Box17.
Example answer is
[[
axy=0,0.7841005286907862
axz=0,0
ayz=0.7841005286907862,0
bxy=0.6838238902874513,0
bxz=0.6838238902874513,0
byz=0,0
cxy=0,0
cxz=0,0.7711475494496229
cyz=0,0.7711475494496229
]]
<a name="docB_034">
axz=0,0 say: take a,x,z to draw
triangle.
byz=0,0 say: take b,y,z to draw
triangle.
cxy=0,0 say: take c,x,y to draw
triangle.
They are three semilunar triangles
QCDraw fig.6 has six 90 deg. sides.
They are created by [verify01]
is a drawing tool.
2011-07-06-20-53 stop
<a name="docB_035">
2011-07-07-16-47 start
Just created function yearMdhm().
Output in Box11 added one line
/***** Data created on 2011-07-10-10-45-17;Sun *****/
for
year-month-day-hour-minute-second
and weekday name.
Time stamp is important to every
user.
2011-07-07-16-50 stop
<a name="docB_036">
2011-07-09-18-18 start
During work, find mat33det()
which is not used. Build one
click button
to use it.
Please store a 3 by 3 matrix to
Box16. Click button. matrix
determinant value output to
Box17. All matrix in
"Box15, rotation matrix" are
rotation matrix. Use
to verify.
All rotation matrix has
determinant value one
2011-07-09-18-25 stop