点数:
IO.read
到目前为止,我已经完成了:
A -2.08576 1.76533 -0.46417
B -0.95929 0.87554 0.03365
C 0.28069 1.66193 0.42640
D 0.62407 2.22927 -0.44649
引用的值为#!/bin/bash
awk 'NR==1' $FILE > LINEA
awk 'NR==1' $FILE > LINEB
awk 'NR==1' $FILE > LINEC
awk 'NR==1' $FILE > LINED
x1=`awk '{print $2}' LINEA` # x1
y1=`awk '{print $3}' LINEA` # y1
z1=`awk '{print $4}' LINEA` # z1
x2=`awk '{print $2}' LINEB` # x2
y2=`awk '{print $3}' LINEB` # y2
z2=`awk '{print $4}' LINEB` # z2
x3=`awk '{print $2}' LINEC` # x3
y3=`awk '{print $3}' LINEC` # y3
z3=`awk '{print $4}' LINEC` # z3
x4=`awk '{print $2}' LINED` # x4
y4=`awk '{print $3}' LINED` # y4
z4=`awk '{print $4}' LINED` # z4
v1x=`calc "($x1)-($x2)" | sed 's/^\t//g'`
v1y=`calc "($y1)-($y2)" | sed 's/^\t//g'`
v1z=`calc "($z1)-($z2)" | sed 's/^\t//g'`
v2x=`calc "($x4)-($x3)" | sed 's/^\t//g'`
v2y=`calc "($y4)-($y3)" | sed 's/^\t//g'`
v2z=`calc "($z4)-($z3)" | sed 's/^\t//g'`
v1mag=`calc "sqrt(($v1x)**2+($v1y)**2+($v1z)**2)" | sed 's/^\t//g'`
v2mag=`calc "sqrt(($v2x)**2+($v2y)**2+($v2z)**2)" | sed 's/^\t//g'`
calc "acos((($v1x)/($v1mag))*(($v2x)/($v2mag))+(($v1y)/($v1mag))*(($v2y)/($v2mag))+(($v1z)/($v1mag))*(($v2z)/($v2mag)))*180/3.141592653589793" | sed 's/^\t//g' | sed 's/^~//g'
calc "acos((($x1)*($x4)+($y1)*($y4)+($z1)*($z4))/(sqrt(($x1)**2+($y1)**2+($z1)**2)*sqrt(($x4)**2+($y4)**2+($z4)**2)))*180/3.141592653589793" | sed 's/^\t//g' | sed 's/^~//g'
我得到的价值是:58.7 $^{o}$
和70.62525933704842342761 $^{o}$
有人知道获得它的最佳算法是什么?
答案 0 :(得分:4)
编辑:如果您的互联网搜索torsion.awk
已将您带到此处,请跳过上面接受的答案,因为它使用OP精炼算法来计算扭转,但仍然显示转换shell代码为awk
。
以前的读者也注意到在下面的第二个编辑中使用此代码的改进。
我刚注意到最后的“正确”资格; - /
这是您的代码转换为一个awk进程。
我没有这种数学水平的经验,所以不能说它确实在计算你需要的结果。
此外,经常有关于awk程序精度的问题,这些问题与编译的基础c
语言库有关。
无论如何,对于所有注意事项,这是对代码的基本转换。
cat torsion_docd.awk
#!/bin/awk -f
function acos(x) { return atan2((1.-x^2)^0.5,x) }
# x1=`awk '{print $2}' LINEA` # x1
# y1=`awk '{print $3}' LINEA` # y1
# z1=`awk '{print $4}' LINEA` # z1
# x2=`awk '{print $2}' LINEB` # x2
# y2=`awk '{print $3}' LINEB` # y2
# z2=`awk '{print $4}' LINEB` # z2
# x3=`awk '{print $2}' LINEC` # x3
# y3=`awk '{print $3}' LINEC` # y3
# z3=`awk '{print $4}' LINEC` # z3
# x4=`awk '{print $2}' LINED` # x4
# y4=`awk '{print $3}' LINED` # y4
# z4=`awk '{print $4}' LINED` # z4
NR==1 {x1=$2; y=$3; z1=$4}
NR==2 {x2=$2; y=$3; z2=$4}
NR==3 {x3=$2; y=$3; z3=$4}
NR==4 {
x4=$2; y=$3; z4=$4
# all of this code below is only executed when you read in the 4th line
# becuase then you have all the data
# v1x=`calc "($x1)-($x2)" | sed 's/^\t//g'`
# v1y=`calc "($y1)-($y2)" | sed 's/^\t//g'`
# v1z=`calc "($z1)-($z2)" | sed 's/^\t//g'`
# v2x=`calc "($x4)-($x3)" | sed 's/^\t//g'`
# v2y=`calc "($y4)-($y3)" | sed 's/^\t//g'`
# v2z=`calc "($z4)-($z3)" | sed 's/^\t//g'`
v1x=x1-x2 ; v1y=y1-y2 ; v1z=z1-z2
v2x=x4-x3 ; v2y=y4-y3 ; v2z=z4-z3
# v1mag=`calc "sqrt(($v1x)**2+($v1y)**2+($v1z)**2)" | sed 's/^\t//g'`
# v2mag=`calc "sqrt(($v2x)**2+($v2y)**2+($v2z)**2)" | sed 's/^\t//g'`
v1mag=sqrt((v1x)**2+(v1y)**2+(v1z)**2)
v2mag=sqrt((v2x)**2+(v2y)**2+(v2z)**2)
# calc "acos((($v1x)/($v1mag))*(($v2x)/($v2mag))+(($v1y)/($v1mag))*(($v2y)/($v2mag))+(($v1z)/($v1mag))*(($v2z)/($v2mag)))*180/3.141
592653589793" | sed 's/^\t//g' | sed 's/^~//g'
# calc "acos((($x1)*($x4)+($y1)*($y4)+($z1)*($z4))/(sqrt(($x1)**2+($y1)**2+($z1)**2)*sqrt(($x4)**2+($y4)**2+($z4)**2)))*180/3.14159
2653589793" | sed 's/^\t//g' | sed 's/^~//g'
print acos(((v1x)/(v1mag))*((v2x)/(v2mag))+((v1y)/(v1mag))*((v2y)/(v2mag))+((v1z)/(v1mag))*((v2z)/(v2mag)))*180/3.141592653589793
print acos(((x1)*(x4)+(y1)*(y4)+(z1)*(z4))/(sqrt((x1)**2+(y1)**2+(z1)**2)*sqrt((x4)**2+(y4)**2+(z4)**2)))*180/3.141592653589793
}
没有转换文档,它看起来像
cat torsion.awk
#!/bin/awk -f
function acos(x) { return atan2((1.-x^2)^0.5,x) }
NR==1 {x1=$2; y=$3; z1=$4}
NR==2 {x2=$2; y=$3; z2=$4}
NR==3 {x3=$2; y=$3; z3=$4}
NR==4 {
x4=$2; y=$3; z4=$4
# all of this code below is only executed when you read in the 4th line
# because then you have all the data
v1x=x1-x2 ; v1y=y1-y2 ; v1z=z1-z2
v2x=x4-x3 ; v2y=y4-y3 ; v2z=z4-z3
v1mag=sqrt((v1x)**2+(v1y)**2+(v1z)**2)
v2mag=sqrt((v2x)**2+(v2y)**2+(v2z)**2)
print acos(((v1x)/(v1mag))*((v2x)/(v2mag))+((v1y)/(v1mag))*((v2y)/(v2mag))+((v1z)/(v1mag))*((v2z)/(v2mag)))*180/3.141592653589793
print acos(((x1)*(x4)+(y1)*(y4)+(z1)*(z4))/(sqrt((x1)**2+(y1)**2+(z1)**2)*sqrt((x4)**2+(y4)**2+(z4)**2)))*180/3.141592653589793
}
请注意,我在最后两行acos
前添加了打印语句。
在我的机器上,我将其作为
运行awk -f torsion.awk data.txt
编辑:我已将#!/bin/awk
修复为脚本顶部。因此,您需要使用
chmod +x ./torsion.awk
然后你可以像
那样运行它`./torsion.awk data.txt
您的系统可能需要与awk
不同的路径,如顶部的she-bang行(#!/bin/awk
)。输入which awk
,然后在#!
之后使用该值。此外,传统的Unix实现通常安装了awk
的其他版本,因此,如果这是您的操作环境,请进行一些研究以找出系统中哪个是最好的awk
(通常是gawk
# -------------- end edit --------------------
1}})。
87.6318
131.872
<强>输出强>
-58.7
但鉴于您同意acos
是您想要的输出,我将留给您如何使用2 awk
计算。
在任何情况下,希望您可以看到使用{{1}}进行此类计算还有多么直接。
当然,希望真正的数学家能够嘲笑(在笑声之后)并帮助纠正这个问题(或者提出他们自己的想法)。
IHTH
答案 1 :(得分:1)
根据您在此主题中其他地方的精炼shell代码,我也将其转录为awk
解决方案。由于人们似乎找到了_docd
版本的使用,我将在最后添加。我还包括一个调试版本(在回复的中间)。
cat torsion2.awk
-
#!/bin/awk -f
BEGIN {
# dbg=0 # turns off dbg output
# see below for debug version of this script
}
function acos(x) { return atan2((1.-x^2)^0.5,x) }
NR==1 {x1=$2; y1=$3; z1=$4}
NR==2 {x2=$2; y2=$3; z2=$4}
NR==3 {x3=$2; y3=$3; z3=$4}
NR==4 {
x4=$2; y4=$3; z4=$4
# all of this code below is only executed when you read in the 4th line
# because then you have all the data
#
v1x=x2-x1 ; v1y=y2-y1 ; v1z=z2-z1 #plane1
v2x=x3-x2 ; v2y=y3-y2 ; v2z=z3-z2 #plane1
v3x=x2-x3 ; v3y=y2-y3 ; v3z=z2-z3 #plane2
v4x=x3-x4 ; v4y=y3-y4 ; v4z=z3-z4 #plane2
plane1_x=(v1y*v2z)-(v1z*v2y) # normal vector 1
plane1_y=(v2x*v1z)-(v2z*v1x) # normal vector 1
plane1_z=(v1x*v2y)-(v1y*v2x) # normal vector 1
plane2_x=(v3y*v4z)-(v3z*v4y) # normal vector 2
plane2_y=(v4x*v3z)-(v4z*v3x) # normal vector 2
plane2_z=(v3x*v4y)-(v3y*v4x) # normal vector 2
v1mag=sqrt(((plane1_x)**2)+((plane1_y)**2)+((plane1_z)**2)) # magnitude normal vector 1
v2mag=sqrt(((plane2_x)**2)+((plane2_y)**2)+((plane2_z)**2)) # magnitude normal vector 2
vn1x=(plane1_x)/(v1mag) ; vn1y=(plane1_y)/(v1mag) ; vn1z=(plane1_z)/(v1mag) # normalization normal vector 1
vn2x=(plane2_x)/(v2mag) ; vn2y=(plane2_y)/(v2mag) ; vn2z=(plane2_z)/(v2mag) # normalization normal vector 2
print acos((vn1x*vn2x)+(vn1y*vn2y)+(vn1z*vn2z))*180/3.141592653589793
}
保存文件后,您必须将脚本标记为可执行文件:
chmod +x ./torsion2.awk
然后您可以使用提供的示例数据运行它:
./torsion2.awk data.txt
输出
58.6892
这是完整的调试版本。我需要它,因为我有编辑错误,例如将y2=$3
更改为y=$3
! (这些事情发生了; - /)
cat torsion2_debug.awk
#!/bin/awk -f
BEGIN {
dbg=1 # turns on dbg output
# dbg=0 # turns off dbg output
}
function acos(x) { return atan2((1.-x^2)^0.5,x) }
NR==1 {x1=$2; y1=$3; z1=$4}
NR==2 {x2=$2; y2=$3; z2=$4}
NR==3 {x3=$2; y3=$3; z3=$4}
NR==4 {
x4=$2; y4=$3; z4=$4
if (dbg) {
print "x1="x1 "\ty1="y1 "\tz1=" z1
print "x2="x2 "\ty2="y2 "\tz2=" z2
print "x3="x3 "\ty3="y3 "\tz3=" z3
print "x4="x4 "\ty4="y4 "\tz4=" z4
}
# all of this code below is only executed when you read in the 4th line
# because then you have all the data
#
v1x=x2-x1 ; v1y=y2-y1 ; v1z=z2-z1 #plane1
v2x=x3-x2 ; v2y=y3-y2 ; v2z=z3-z2 #plane1
v3x=x2-x3 ; v3y=y2-y3 ; v3z=z2-z3 #plane2
v4x=x3-x4 ; v4y=y3-y4 ; v4z=z3-z4 #plane2
if (dbg) {
print "#dbg: v1x="v1x "\tv1y=" v1y "\tv1z="v1z
print "#dbg: v2x="v2x "\tv2y=" v2y "\tv2z="v2z
print "#dbg: v3x="v3x "\tv3y=" v3y "\tv3z="v3z
print "#dbg: v4x="v4x "\tv4y=" v4y "\tv4z="v4z
}
plane1_x=(v1y*v2z)-(v1z*v2y) # normal vector 1
plane1_y=(v2x*v1z)-(v2z*v1x) # normal vector 1
plane1_z=(v1x*v2y)-(v1y*v2x) # normal vector 1
plane2_x=(v3y*v4z)-(v3z*v4y) # normal vector 2
plane2_y=(v4x*v3z)-(v4z*v3x) # normal vector 2
plane2_z=(v3x*v4y)-(v3y*v4x) # normal vector 2
if (dbg) {
print "#dbg: plane1_x=" plane1_x "\tplane1_y=" plane1_y "\tplane1_z=" plane1_z
print "#dbg: plane2_x=" plane2_x "\tplane2_y=" plane2_y "\tplane2_z=" plane2_z
}
v1mag=sqrt(((plane1_x)**2)+((plane1_y)**2)+((plane1_z)**2)) # magnitude normal vector 1
v2mag=sqrt(((plane2_x)**2)+((plane2_y)**2)+((plane2_z)**2)) # magnitude normal vector 2
if (dbg) {
print "#dbg: v1mag=" v1mag "\tv2mag="v2mag
}
vn1x=(plane1_x)/(v1mag) ; vn1y=(plane1_y)/(v1mag) ; vn1z=(plane1_z)/(v1mag) # normalization normal vector 1
vn2x=(plane2_x)/(v2mag) ; vn2y=(plane2_y)/(v2mag) ; vn2z=(plane2_z)/(v2mag) # normalization normal vector 2
if (dbg) {
print "#dbg: " (vn1x*vn2x) " " (vn1y*vn2y) " " ((vn1z*vn2z)*180/3.141592653589793)
}
print acos((vn1x*vn2x)+(vn1y*vn2y)+(vn1z*vn2z))*180/3.141592653589793
}
这里是awk版本的转录shell
我强烈建议Grymoire's Awk Tutorial帮助您了解awk
编程范例及其内置变量,例如NR
(Number(of)Record)。
cat torsion2_docd.awk
#!/bin/awk -f
function acos(x) { return atan2((1.-x^2)^0.5,x) }
# x1=`awk '{print $2}' LINEA` # x1
# y1=`awk '{print $3}' LINEA` # y1
# z1=`awk '{print $4}' LINEA` # z1
# x2=`awk '{print $2}' LINEB` # x2
# y2=`awk '{print $3}' LINEB` # y2
# z2=`awk '{print $4}' LINEB` # z2
# x3=`awk '{print $2}' LINEC` # x3
# y3=`awk '{print $3}' LINEC` # y3
# z3=`awk '{print $4}' LINEC` # z3
# x4=`awk '{print $2}' LINED` # x4
# y4=`awk '{print $3}' LINED` # y4
# z4=`awk '{print $4}' LINED` # z4
NR==1 {x1=$2; y1=$3; z1=$4}
NR==2 {x2=$2; y2=$3; z2=$4}
NR==3 {x3=$2; y3=$3; z3=$4}
NR==4 {
x4=$2; y=$3; z4=$4
# all of this code below is only executed when you read in the 4th line
# because then you have all the data
#
# v1x=`calc "($x2)-($x1)" | sed 's/^\t//g'` #plane1
# v1y=`calc "($y2)-($y1)" | sed 's/^\t//g'` #plane1
# v1z=`calc "($z2)-($z1)" | sed 's/^\t//g'` #plane1
# v2x=`calc "($x3)-($x2)" | sed 's/^\t//g'` #plane1
# v2y=`calc "($y3)-($y2)" | sed 's/^\t//g'` #plane1
# v2z=`calc "($z3)-($z2)" | sed 's/^\t//g'` #plane1
# v3x=`calc "($x2)-($x3)" | sed 's/^\t//g'` #plane2
# v3y=`calc "($y2)-($y3)" | sed 's/^\t//g'` #plane2
# v3z=`calc "($z2)-($z3)" | sed 's/^\t//g'` #plane2
# v4x=`calc "($x3)-($x4)" | sed 's/^\t//g'` #plane2
# v4y=`calc "($y3)-($y4)" | sed 's/^\t//g'` #plane2
# v4z=`calc "($z3)-($z4)" | sed 's/^\t//g'` #plane2
v1x=x2-x1 ; v1y=y2-y1 ; v1z=z2-z1 #plane1
v2x=x3-x2 ; v2y=y3-y2 ; v2z=z3-z2 #plane1
v3x=x2-x3 ; v3y=y2-y3 ; v3z=z2-z3 #plane2
v1x=x2-x1 ; v1y=y2-y1 ; v1z=z2-z1 #plane1
v2x=x3-x2 ; v2y=y3-y2 ; v2z=z3-z2 #plane1
v3x=x2-x3 ; v3y=y2-y3 ; v3z=z2-z3 #plane2
v4x=x3-x4 ; v4y=y3-y4 ; v4z=z3-z4 #plane2
# plane1_x=`calc "($v1y)*($v2z)-($v1z)*($v2y)" | sed 's/^\t//g'` # normal vector 1
# plane1_y=`calc "($v2x)*($v1z)-($v2z)*($v1x)" | sed 's/^\t//g'` # normal vector 1
# plane1_z=`calc "($v1x)*($v2y)-($v1y)*($v2x)" | sed 's/^\t//g'` # normal vector 1
# plane2_x=`calc "($v3y)*($v4z)-($v3z)*($v4y)" | sed 's/^\t//g'` # normal vector 2
# plane2_y=`calc "($v4x)*($v3z)-($v4z)*($v3x)" | sed 's/^\t//g'` # normal vector 2
# plane2_z=`calc "($v3x)*($v4y)-($v3y)*($v4x)" | sed 's/^\t//g'` # normal vector 2
plane1_x=(v1y*v2z)-(v1z*v2y) # normal vector 1
plane1_y=(v2x*v1z)-(v2z*v1x) # normal vector 1
plane1_z=(v1x*v2y)-(v1y*v2x) # normal vector 1
plane2_x=(v3y*v4z)-(v3z*v4y) # normal vector 2
plane2_y=(v4x*v3z)-(v4z*v3x) # normal vector 2
plane2_z=(v3x*v4y)-(v3y*v4x) # normal vector 2
# v1mag=`calc "sqrt(($plane1_x)**2+($plane1_y)**2+($plane1_z)**2)" | sed 's/^\t//g'` # magnitude normal vector 1
# v2mag=`calc "sqrt(($plane2_x)**2+($plane2_y)**2+($plane2_z)**2)" | sed 's/^\t//g'` # magnitude normal vector 2
v1mag=sqrt((plane1_x)**2+(plane1_y)**2+(plane1_z)**2) # magnitude normal vector 1
v2mag=sqrt((plane2_x)**2+(plane2_y)**2+(plane2_z)**2) # magnitude normal vector 2
# vn1x=`calc "($plane1_x)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
# vn1y=`calc "($plane1_y)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
# vn1z=`calc "($plane1_z)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
# vn2x=`calc "($plane2_x)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
# vn2y=`calc "($plane2_y)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
# vn2z=`calc "($plane2_z)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
vn1x=(plane1_x)/(v1mag) ; vn1y=(plane1_y)/(v1mag) ; vn1z=(plane1_z)/(v1mag) # normalization normal vector 1
vn2x=(plane2_x)/(v2mag) ; vn2y=(plane2_y)/(v2mag) ; vn2z=(plane2_z)/(v2mag) # normalization normal vector 2
# calc "acos(($vn1x)*($vn2x)+($vn1y)*($vn2y)+($vn1z)*($vn2z))*180/3.141592653589793" | sed 's/^\t//g' | sed 's/^~//g'
print acos((vn1x*vn2x)+(vn1y*vn2y)+(vn1z*vn2z))*180/3.141592653589793
}
答案 2 :(得分:0)
经过漫长的一夜,我找到了解决方案:
awk -v var=$((x+2)) 'NR==var' $FILE > LINEaa
awk -v var=$((y+2)) 'NR==var' $FILE > LINEbb
awk -v var=$((z+2)) 'NR==var' $FILE > LINEcc
awk -v var=$((w+2)) 'NR==var' $FILE > LINEd
x1=`awk '{print $2}' LINEaa` # x1
y1=`awk '{print $3}' LINEaa` # y1
z1=`awk '{print $4}' LINEaa` # z1
x2=`awk '{print $2}' LINEbb` # x2
y2=`awk '{print $3}' LINEbb` # y2
z2=`awk '{print $4}' LINEbb` # z2
x3=`awk '{print $2}' LINEcc` # x3
y3=`awk '{print $3}' LINEcc` # y3
z3=`awk '{print $4}' LINEcc` # z3
x4=`awk '{print $2}' LINEd` # x4
y4=`awk '{print $3}' LINEd` # y4
z4=`awk '{print $4}' LINEd` # z4
v1x=`calc "($x2)-($x1)" | sed 's/^\t//g'` #plane1
v1y=`calc "($y2)-($y1)" | sed 's/^\t//g'` #plane1
v1z=`calc "($z2)-($z1)" | sed 's/^\t//g'` #plane1
v2x=`calc "($x3)-($x2)" | sed 's/^\t//g'` #plane1
v2y=`calc "($y3)-($y2)" | sed 's/^\t//g'` #plane1
v2z=`calc "($z3)-($z2)" | sed 's/^\t//g'` #plane1
v3x=`calc "($x2)-($x3)" | sed 's/^\t//g'` #plane2
v3y=`calc "($y2)-($y3)" | sed 's/^\t//g'` #plane2
v3z=`calc "($z2)-($z3)" | sed 's/^\t//g'` #plane2
v4x=`calc "($x3)-($x4)" | sed 's/^\t//g'` #plane2
v4y=`calc "($y3)-($y4)" | sed 's/^\t//g'` #plane2
v4z=`calc "($z3)-($z4)" | sed 's/^\t//g'` #plane2
plane1_x=`calc "($v1y)*($v2z)-($v1z)*($v2y)" | sed 's/^\t//g'` # normal vector 1
plane1_y=`calc "($v2x)*($v1z)-($v2z)*($v1x)" | sed 's/^\t//g'` # normal vector 1
plane1_z=`calc "($v1x)*($v2y)-($v1y)*($v2x)" | sed 's/^\t//g'` # normal vector 1
plane2_x=`calc "($v3y)*($v4z)-($v3z)*($v4y)" | sed 's/^\t//g'` # normal vector 2
plane2_y=`calc "($v4x)*($v3z)-($v4z)*($v3x)" | sed 's/^\t//g'` # normal vector 2
plane2_z=`calc "($v3x)*($v4y)-($v3y)*($v4x)" | sed 's/^\t//g'` # normal vector 2
v1mag=`calc "sqrt(($plane1_x)**2+($plane1_y)**2+($plane1_z)**2)" | sed 's/^\t//g'` # magnitude normal vector 1
v2mag=`calc "sqrt(($plane2_x)**2+($plane2_y)**2+($plane2_z)**2)" | sed 's/^\t//g'` # magnitude normal vector 2
vn1x=`calc "($plane1_x)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
vn1y=`calc "($plane1_y)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
vn1z=`calc "($plane1_z)/($v1mag)" | sed 's/^\t//g'` # normalization normal vector 1
vn2x=`calc "($plane2_x)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
vn2y=`calc "($plane2_y)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
vn2z=`calc "($plane2_z)/($v2mag)" | sed 's/^\t//g'` # normalization normal vector 2
calc "acos(($vn1x)*($vn2x)+($vn1y)*($vn2y)+($vn1z)*($vn2z))*180/3.141592653589793" | sed 's/^\t//g' | sed 's/^~//g'