occt-gltf-addon-linux-x64 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/LICENSE_LGPL_21.txt +502 -0
  2. package/OCCT_LGPL_EXCEPTION.txt +10 -0
  3. package/README.md +2 -2
  4. package/index.js +63 -1
  5. package/lib/libTKBO.so.8.0.0 +0 -0
  6. package/lib/libTKBRep.so.8.0.0 +0 -0
  7. package/lib/libTKBin.so.8.0.0 +0 -0
  8. package/lib/libTKBinL.so.8.0.0 +0 -0
  9. package/lib/libTKBinTObj.so.8.0.0 +0 -0
  10. package/lib/libTKBinXCAF.so.8.0.0 +0 -0
  11. package/lib/libTKBool.so.8.0.0 +0 -0
  12. package/lib/libTKCAF.so.8.0.0 +0 -0
  13. package/lib/libTKCDF.so.8.0.0 +0 -0
  14. package/lib/libTKDE.so.8.0.0 +0 -0
  15. package/lib/libTKDECascade.so.8.0.0 +0 -0
  16. package/lib/libTKDEIGES.so.8.0.0 +0 -0
  17. package/lib/libTKDEOBJ.so.8.0.0 +0 -0
  18. package/lib/libTKDEPLY.so.8.0.0 +0 -0
  19. package/lib/libTKDESTEP.so.8.0.0 +0 -0
  20. package/lib/libTKDESTL.so.8.0.0 +0 -0
  21. package/lib/libTKDEVRML.so.8.0.0 +0 -0
  22. package/lib/libTKExpress.so.8.0.0 +0 -0
  23. package/lib/libTKFeat.so.8.0.0 +0 -0
  24. package/lib/libTKFillet.so.8.0.0 +0 -0
  25. package/lib/libTKG2d.so.8.0.0 +0 -0
  26. package/lib/libTKG3d.so.8.0.0 +0 -0
  27. package/lib/libTKGeomAlgo.so.8.0.0 +0 -0
  28. package/lib/libTKGeomBase.so.8.0.0 +0 -0
  29. package/lib/libTKHLR.so.8.0.0 +0 -0
  30. package/lib/libTKHelix.so.8.0.0 +0 -0
  31. package/lib/libTKLCAF.so.8.0.0 +0 -0
  32. package/lib/libTKMath.so.8.0.0 +0 -0
  33. package/lib/libTKMesh.so.8.0.0 +0 -0
  34. package/lib/libTKOffset.so.8.0.0 +0 -0
  35. package/lib/libTKPrim.so.8.0.0 +0 -0
  36. package/lib/libTKRWMesh.so.8.0.0 +0 -0
  37. package/lib/libTKService.so.8.0.0 +0 -0
  38. package/lib/libTKShHealing.so.8.0.0 +0 -0
  39. package/lib/libTKStd.so.8.0.0 +0 -0
  40. package/lib/libTKStdL.so.8.0.0 +0 -0
  41. package/lib/libTKTObj.so.8.0.0 +0 -0
  42. package/lib/libTKTopAlgo.so.8.0.0 +0 -0
  43. package/lib/libTKV3d.so.8.0.0 +0 -0
  44. package/lib/libTKVCAF.so.8.0.0 +0 -0
  45. package/lib/libTKXCAF.so.8.0.0 +0 -0
  46. package/lib/libTKXMesh.so.8.0.0 +0 -0
  47. package/lib/libTKXSBase.so.8.0.0 +0 -0
  48. package/lib/libTKXml.so.8.0.0 +0 -0
  49. package/lib/libTKXmlL.so.8.0.0 +0 -0
  50. package/lib/libTKXmlTObj.so.8.0.0 +0 -0
  51. package/lib/libTKXmlXCAF.so.8.0.0 +0 -0
  52. package/lib/libTKernel.so.8.0.0 +0 -0
  53. package/lib/libdraco.so.1 +0 -0
  54. package/lib/libtbb.so.2 +0 -0
  55. package/lib/libtbbmalloc.so.2 +0 -0
  56. package/lib/libtbbmalloc_proxy.so.2 +0 -0
  57. package/occt_gltf_addon.node +0 -0
  58. package/package.json +6 -2
  59. package/resources/BOPAlgo/BOPAlgo.msg +129 -0
  60. package/resources/BOPAlgo/FILES +1 -0
  61. package/resources/DrawResources/CURVES.tcl +38 -0
  62. package/resources/DrawResources/CheckCommands.tcl +1206 -0
  63. package/resources/DrawResources/DrawDefault +130 -0
  64. package/resources/DrawResources/DrawPlugin +64 -0
  65. package/resources/DrawResources/DrawTK.tcl +623 -0
  66. package/resources/DrawResources/FILES +16 -0
  67. package/resources/DrawResources/Geometry.tcl +96 -0
  68. package/resources/DrawResources/InitEnvironment.tcl +50 -0
  69. package/resources/DrawResources/Move.tcl +85 -0
  70. package/resources/DrawResources/OCC_logo.png +0 -0
  71. package/resources/DrawResources/PROFIL.tcl +726 -0
  72. package/resources/DrawResources/SCAN.tcl +192 -0
  73. package/resources/DrawResources/SURFACES.tcl +35 -0
  74. package/resources/DrawResources/StandardCommands.tcl +451 -0
  75. package/resources/DrawResources/StandardViews.tcl +284 -0
  76. package/resources/DrawResources/TKTopTest.tcl +27 -0
  77. package/resources/DrawResources/TestCommands.tcl +2969 -0
  78. package/resources/DrawResources/Vector.tcl +402 -0
  79. package/resources/DrawResources/dfb_attribns.gif +0 -0
  80. package/resources/DrawResources/dfb_attribute.gif +0 -0
  81. package/resources/DrawResources/dfb_folder.gif +0 -0
  82. package/resources/DrawResources/dftree.tcl +381 -0
  83. package/resources/DrawResources/lamp.ico +0 -0
  84. package/resources/SHMessage/FILES +2 -0
  85. package/resources/SHMessage/SHAPE.fr +267 -0
  86. package/resources/SHMessage/SHAPE.us +267 -0
  87. package/resources/Shaders/Declarations.glsl +276 -0
  88. package/resources/Shaders/DeclarationsImpl.glsl +121 -0
  89. package/resources/Shaders/Display.fs +157 -0
  90. package/resources/Shaders/FILES +27 -0
  91. package/resources/Shaders/LightShadow.glsl +48 -0
  92. package/resources/Shaders/PBRCookTorrance.glsl +20 -0
  93. package/resources/Shaders/PBRDirectionalLight.glsl +20 -0
  94. package/resources/Shaders/PBRDistribution.glsl +9 -0
  95. package/resources/Shaders/PBREnvBaking.fs +226 -0
  96. package/resources/Shaders/PBREnvBaking.vs +55 -0
  97. package/resources/Shaders/PBRFresnel.glsl +36 -0
  98. package/resources/Shaders/PBRGeometry.glsl +13 -0
  99. package/resources/Shaders/PBRIllumination.glsl +28 -0
  100. package/resources/Shaders/PBRPointLight.glsl +27 -0
  101. package/resources/Shaders/PBRSpotLight.glsl +45 -0
  102. package/resources/Shaders/PathtraceBase.fs +993 -0
  103. package/resources/Shaders/PhongDirectionalLight.glsl +29 -0
  104. package/resources/Shaders/PhongPointLight.glsl +36 -0
  105. package/resources/Shaders/PhongShading.fs +191 -0
  106. package/resources/Shaders/PhongShading.vs +43 -0
  107. package/resources/Shaders/PhongSpotLight.glsl +52 -0
  108. package/resources/Shaders/PointLightAttenuation.glsl +35 -0
  109. package/resources/Shaders/RaytraceBase.fs +1236 -0
  110. package/resources/Shaders/RaytraceBase.vs +12 -0
  111. package/resources/Shaders/RaytraceRender.fs +134 -0
  112. package/resources/Shaders/RaytraceSmooth.fs +80 -0
  113. package/resources/Shaders/SkydomBackground.fs +300 -0
  114. package/resources/Shaders/TangentSpaceNormal.glsl +17 -0
  115. package/resources/StdResource/FILES +6 -0
  116. package/resources/StdResource/MigrationSheet.txt +21 -0
  117. package/resources/StdResource/Plugin +52 -0
  118. package/resources/StdResource/Standard +25 -0
  119. package/resources/StdResource/StandardLite +22 -0
  120. package/resources/StdResource/TObj +17 -0
  121. package/resources/StdResource/XCAF +50 -0
  122. package/resources/TObj/FILES +1 -0
  123. package/resources/TObj/TObj.msg +85 -0
  124. package/resources/Textures/1d_elevation.rgb +0 -0
  125. package/resources/Textures/2d_MatraDatavision.rgb +0 -0
  126. package/resources/Textures/2d_alienskin.rgb +0 -0
  127. package/resources/Textures/2d_aluminum.rgb +0 -0
  128. package/resources/Textures/2d_blue_rock.rgb +0 -0
  129. package/resources/Textures/2d_bluewhite_paper.rgb +0 -0
  130. package/resources/Textures/2d_brushed.rgb +0 -0
  131. package/resources/Textures/2d_bubbles.rgb +0 -0
  132. package/resources/Textures/2d_bumps.rgb +0 -0
  133. package/resources/Textures/2d_cast.rgb +0 -0
  134. package/resources/Textures/2d_chess.rgba +0 -0
  135. package/resources/Textures/2d_chipbd.rgb +0 -0
  136. package/resources/Textures/2d_clouds.rgb +0 -0
  137. package/resources/Textures/2d_flesh.rgb +0 -0
  138. package/resources/Textures/2d_floor.rgb +0 -0
  139. package/resources/Textures/2d_galvnisd.rgb +0 -0
  140. package/resources/Textures/2d_grass.rgb +0 -0
  141. package/resources/Textures/2d_knurl.rgb +0 -0
  142. package/resources/Textures/2d_maple.rgb +0 -0
  143. package/resources/Textures/2d_marble.rgb +0 -0
  144. package/resources/Textures/2d_mottled.rgb +0 -0
  145. package/resources/Textures/2d_rain.rgb +0 -0
  146. package/resources/Textures/2d_rock.rgb +0 -0
  147. package/resources/Textures/FILES +31 -0
  148. package/resources/Textures/env_clouds.rgb +0 -0
  149. package/resources/Textures/env_cv.rgb +0 -0
  150. package/resources/Textures/env_lines.rgb +0 -0
  151. package/resources/Textures/env_medit.rgb +0 -0
  152. package/resources/Textures/env_pearl.rgb +0 -0
  153. package/resources/Textures/env_road.rgb +0 -0
  154. package/resources/Textures/env_sky1.rgb +0 -0
  155. package/resources/Textures/env_sky2.rgb +0 -0
  156. package/resources/UnitsAPI/CurrentUnits +74 -0
  157. package/resources/UnitsAPI/FILES +4 -0
  158. package/resources/UnitsAPI/MDTVBaseUnits +70 -0
  159. package/resources/UnitsAPI/MDTVCurrentUnits +74 -0
  160. package/resources/UnitsAPI/Units.dat +481 -0
  161. package/resources/XRResources/FILES +10 -0
  162. package/resources/XRResources/occtvr_actions.json +225 -0
  163. package/resources/XRResources/occtvr_bindings_generic.json +87 -0
  164. package/resources/XRResources/occtvr_bindings_holographic_hmd.json +18 -0
  165. package/resources/XRResources/occtvr_bindings_index_hmd.json +18 -0
  166. package/resources/XRResources/occtvr_bindings_rift.json +18 -0
  167. package/resources/XRResources/occtvr_bindings_touch.json +160 -0
  168. package/resources/XRResources/occtvr_bindings_vive.json +18 -0
  169. package/resources/XRResources/occtvr_bindings_vive_controller.json +139 -0
  170. package/resources/XRResources/occtvr_bindings_vive_cosmos.json +18 -0
  171. package/resources/XRResources/occtvr_bindings_vive_pro.json +18 -0
  172. package/resources/XSMessage/FILES +2 -0
  173. package/resources/XSMessage/XSTEP.fr +1026 -0
  174. package/resources/XSMessage/XSTEP.us +1023 -0
  175. package/resources/XSTEPResource/FILES +2 -0
  176. package/resources/XSTEPResource/IGES +65 -0
  177. package/resources/XSTEPResource/STEP +68 -0
  178. package/resources/XmlOcafResource/FILES +11 -0
  179. package/resources/XmlOcafResource/XmlOcaf.xsd +131 -0
  180. package/resources/XmlOcafResource/XmlOcaf_SmallTypes.xsd +217 -0
  181. package/resources/XmlOcafResource/XmlOcaf_TDF.xsd +33 -0
  182. package/resources/XmlOcafResource/XmlOcaf_TDataStd.xsd +230 -0
  183. package/resources/XmlOcafResource/XmlOcaf_TDataStd_Name.xsd +37 -0
  184. package/resources/XmlOcafResource/XmlOcaf_TDocStd.xsd +37 -0
  185. package/resources/XmlOcafResource/XmlOcaf_TFunction.xsd +38 -0
  186. package/resources/XmlOcafResource/XmlOcaf_TNaming.xsd +128 -0
  187. package/resources/XmlOcafResource/XmlOcaf_TNaming_NamedShape.xsd +97 -0
  188. package/resources/XmlOcafResource/XmlOcaf_TPrsStd.xsd +42 -0
  189. package/resources/XmlOcafResource/XmlXcaf.xsd +109 -0
  190. package/resources/samples/tcl/ANC101.tcl +282 -0
  191. package/resources/samples/tcl/DataExchangeDemo.tcl +85 -0
  192. package/resources/samples/tcl/MBBGehauseRohteil.tcl +268 -0
  193. package/resources/samples/tcl/ModelingDemo.tcl +120 -0
  194. package/resources/samples/tcl/Penrose.tcl +87 -0
  195. package/resources/samples/tcl/Readme.txt +4 -0
  196. package/resources/samples/tcl/VisualizationDemo.tcl +162 -0
  197. package/resources/samples/tcl/bottle.tcl +115 -0
  198. package/resources/samples/tcl/cad.tcl +63 -0
  199. package/resources/samples/tcl/cpu.tcl +327 -0
  200. package/resources/samples/tcl/cutter.tcl +91 -0
  201. package/resources/samples/tcl/dimensions.tcl +83 -0
  202. package/resources/samples/tcl/drill.tcl +147 -0
  203. package/resources/samples/tcl/logo2019.tcl +89 -0
  204. package/resources/samples/tcl/markers.tcl +76 -0
  205. package/resources/samples/tcl/materials.tcl +75 -0
  206. package/resources/samples/tcl/pathtrace_ball.tcl +79 -0
  207. package/resources/samples/tcl/pathtrace_cube.tcl +85 -0
  208. package/resources/samples/tcl/pathtrace_materials.tcl +229 -0
  209. package/resources/samples/tcl/pencil.tcl +64 -0
  210. package/resources/samples/tcl/raytrace.tcl +44 -0
  211. package/resources/samples/tcl/snowflake.tcl +161 -0
  212. package/resources/samples/tcl/spheres.tcl +148 -0
  213. package/resources/samples/tcl/vis_pbr_spheres.tcl +94 -0
  214. package/resources/samples/tcl/xde.tcl +47 -0
@@ -0,0 +1,402 @@
1
+ # Copyright (c) 2016 OPEN CASCADE SAS
2
+ #
3
+ # This file is part of Open CASCADE Technology software library.
4
+ #
5
+ # This library is free software; you can redistribute it and/or modify it under
6
+ # the terms of the GNU Lesser General Public License version 2.1 as published
7
+ # by the Free Software Foundation, with special exception defined in the file
8
+ # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9
+ # distribution for complete text of the license and disclaimer of any warranty.
10
+ #
11
+ # Alternatively, this file may be used under the terms of Open CASCADE
12
+ # commercial license or contractual agreement.
13
+ #
14
+ # Created by: M.Sazonov
15
+ #
16
+ # Working with vectors and various measurements
17
+ #
18
+ # [2d] point is represented by (two/three) coords
19
+ # [2d] vector is represented by (two/three) coords
20
+ # plane is represented by an origin point and a normal vector
21
+ # [2d] line is represented by an origin point and a vector
22
+
23
+ help vec {vec x1 y1 z1 x2 y2 z2
24
+ returns coordinates of vector between two points\
25
+ } {Vector and measurement Commands}
26
+
27
+ proc vec {x1 y1 z1 x2 y2 z2} {
28
+ uplevel list [dval ($x2)-($x1)] [dval ($y2)-($y1)] [dval ($z2)-($z1)]
29
+ }
30
+
31
+ help 2dvec {2dvec x1 y1 x2 y2
32
+ returns coordinates of 2D vector between two 2D points\
33
+ } {Vector and measurement Commands}
34
+
35
+ proc 2dvec {x1 y1 x2 y2} {
36
+ uplevel list [dval ($x2)-($x1)] [dval ($y2)-($y1)]
37
+ }
38
+
39
+ help pln {pln x1 y1 z1 x2 y2 z2 x3 y3 z3
40
+ returns plane built on three points\
41
+ } {Vector and measurement Commands}
42
+
43
+ proc pln {x1 y1 z1 x2 y2 z2 x3 y3 z3} {
44
+ set v12 [uplevel eval norm [vec $x1 $y1 $z1 $x2 $y2 $z2]]
45
+ set v13 [uplevel eval norm [vec $x1 $y1 $z1 $x3 $y3 $z3]]
46
+ set vn [eval cross $v12 $v13]
47
+ set N [eval module $vn]
48
+ if [expr $N < 1e-7] {
49
+ puts "points are on a line"
50
+ return
51
+ }
52
+ concat $x1 $y1 $z1 [eval norm $vn]
53
+ }
54
+
55
+ help module {module x y z
56
+ returns module of a vector\
57
+ } {Vector and measurement Commands}
58
+
59
+ proc module {x y z} {
60
+ uplevel dval sqrt(($x)*($x)+($y)*($y)+($z)*($z))
61
+ }
62
+
63
+ help 2dmodule {2dmodule x y
64
+ returns module of a 2D vector\
65
+ } {Vector and measurement Commands}
66
+
67
+ proc 2dmodule {x y} {
68
+ uplevel dval sqrt(($x)*($x)+($y)*($y))
69
+ }
70
+
71
+ help norm {norm x y z
72
+ returns unified vector from a given vector\
73
+ } {Vector and measurement Commands}
74
+
75
+ proc norm {x y z} {
76
+ set N [uplevel dval sqrt(($x)*($x)+($y)*($y)+($z)*($z))]
77
+ list [uplevel dval ($x)/$N] [uplevel dval ($y)/$N] [uplevel dval ($z)/$N]
78
+ }
79
+
80
+ help 2dnorm {2dnorm x y
81
+ returns unified vector from a given 2D vector\
82
+ } {Vector and measurement Commands}
83
+
84
+ proc 2dnorm {x y} {
85
+ set N [uplevel dval sqrt(($x)*($x)+($y)*($y))]
86
+ list [uplevel dval ($x)/$N] [uplevel dval ($y)/$N]
87
+ }
88
+
89
+ help inverse {inverse x y z
90
+ returns inversed vector\
91
+ } {Vector and measurement Commands}
92
+
93
+ proc inverse {x y z} {
94
+ list [uplevel dval -$x] [uplevel dval -$y] [uplevel dval -$z]
95
+ }
96
+
97
+ help 2dinverse {2dinverse x y
98
+ returns inversed 2D vector\
99
+ } {Vector and measurement Commands}
100
+
101
+ proc 2dinverse {x y} {
102
+ list [uplevel dval -$x] [uplevel dval -$y]
103
+ }
104
+
105
+ help 2dort {2dort x y
106
+ returns 2D vector rotated on 90 degrees\
107
+ } {Vector and measurement Commands}
108
+
109
+ proc 2dort {x y} {
110
+ list [uplevel dval -$y] [uplevel dval $x]
111
+ }
112
+
113
+ help distpp {distpp x1 y1 z1 x2 y2 z2
114
+ returns distance between two points\
115
+ } {Vector and measurement Commands}
116
+
117
+ proc distpp {x1 y1 z1 x2 y2 z2} {
118
+ eval module [uplevel vec $x1 $y1 $z1 $x2 $y2 $z2]
119
+ }
120
+
121
+ help 2ddistpp {2ddistpp x1 y1 x2 y2
122
+ returns distance between two 2D points\
123
+ } {Vector and measurement Commands}
124
+
125
+ proc 2ddistpp {x1 y1 x2 y2} {
126
+ eval 2dmodule [uplevel 1 2dvec $x1 $y1 $x2 $y2]
127
+ }
128
+
129
+ help distplp {distplp xo yo zo dx dy dz xp yp zp
130
+ returns distance between plane and point\
131
+ } {Vector and measurement Commands}
132
+
133
+ proc distplp {xo yo zo dx dy dz xp yp zp} {
134
+ set vop [uplevel vec $xo $yo $zo $xp $yp $zp]
135
+ set vn [uplevel norm $dx $dy $dz]
136
+ eval dot $vop $vn
137
+ }
138
+
139
+ help distlp {distlp xo yo zo dx dy dz xp yp zp
140
+ returns distance between line and point\
141
+ } {Vector and measurement Commands}
142
+
143
+ proc distlp {xo yo zo dx dy dz xp yp zp} {
144
+ set vop [uplevel vec $xo $yo $zo $xp $yp $zp]
145
+ set vl [uplevel norm $dx $dy $dz]
146
+ eval module [eval cross $vl $vop]
147
+ }
148
+
149
+ help 2ddistlp {2ddistlp xo yo dx dy xp yp
150
+ returns distance between 2D line and point\
151
+ } {Vector and measurement Commands}
152
+
153
+ proc 2ddistlp {xo yo dx dy xp yp} {
154
+ set vop [uplevel 1 2dvec $xo $yo $xp $yp]
155
+ set vl [uplevel 1 2dnorm $dx $dy]
156
+ eval 2dcross $vl $vop
157
+ }
158
+
159
+ help distppp {distppp x1 y1 z1 x2 y2 z2 x3 y3 z3
160
+ returns deviation of point p2 from segment p1-p3\
161
+ } {Vector and measurement Commands}
162
+
163
+ proc distppp {x1 y1 z1 x2 y2 z2 x3 y3 z3} {
164
+ set vop [uplevel vec $x1 $y1 $z1 $x2 $y2 $z2]
165
+ set vl [uplevel eval norm [vec $x1 $y1 $z1 $x3 $y3 $z3]]
166
+ eval module [eval cross $vl $vop]
167
+ }
168
+
169
+ help 2ddistppp {2ddistppp x1 y1 x2 y2 x3 y3
170
+ returns deviation of 2D point p2 from segment p1-p3 (sign shows the side)\
171
+ } {Vector and measurement Commands}
172
+
173
+ proc 2ddistppp {x1 y1 x2 y2 x3 y3} {
174
+ set vop [uplevel 1 2dvec $x1 $y1 $x2 $y2]
175
+ set vl [uplevel eval 2dnorm [2dvec $x1 $y1 $x3 $y3]]
176
+ eval 2dcross $vl $vop
177
+ }
178
+
179
+ help barycen {barycen x1 y1 z1 x2 y2 z2 par
180
+ returns point of a given parameter between two points\
181
+ } {Vector and measurement Commands}
182
+
183
+ proc barycen {x1 y1 z1 x2 y2 z2 par} {
184
+ uplevel list [dval ($x1)*(1-($par))+($x2)*($par)]\
185
+ [dval ($y1)*(1-($par))+($y2)*($par)]\
186
+ [dval ($z1)*(1-($par))+($z2)*($par)]
187
+ }
188
+
189
+ help 2dbarycen {2dbarycen x1 y1 x2 y2 par
190
+ returns 2D point of a given parameter between two points\
191
+ } {Vector and measurement Commands}
192
+
193
+ proc 2dbarycen {x1 y1 x2 y2 par} {
194
+ uplevel list [dval ($x1)*(1-($par))+($x2)*($par)]\
195
+ [dval ($y1)*(1-($par))+($y2)*($par)]
196
+ }
197
+
198
+ help cross {cross x1 y1 z1 x2 y2 z2
199
+ returns cross product of two vectors\
200
+ } {Vector and measurement Commands}
201
+
202
+ proc cross {x1 y1 z1 x2 y2 z2} {
203
+ set x [uplevel dval ($y1)*($z2)-($z1)*($y2)]
204
+ set y [uplevel dval ($z1)*($x2)-($x1)*($z2)]
205
+ set z [uplevel dval ($x1)*($y2)-($y1)*($x2)]
206
+ list $x $y $z
207
+ }
208
+
209
+ help 2dcross {2dcross x1 y1 x2 y2
210
+ returns cross product of two 2D vectors\
211
+ } {Vector and measurement Commands}
212
+
213
+ proc 2dcross {x1 y1 x2 y2} {
214
+ uplevel dval ($x1)*($y2)-($y1)*($x2)
215
+ }
216
+
217
+ help dot {dot x1 y1 z1 x2 y2 z2
218
+ returns scalar product of two vectors\
219
+ } {Vector and measurement Commands}
220
+
221
+ proc dot {x1 y1 z1 x2 y2 z2} {
222
+ uplevel dval ($x1)*($x2)+($y1)*($y2)+($z1)*($z2)
223
+ }
224
+
225
+ help 2ddot {2ddot x1 y1 x2 y2
226
+ returns scalar product of two 2D vectors\
227
+ } {Vector and measurement Commands}
228
+
229
+ proc 2ddot {x1 y1 x2 y2} {
230
+ uplevel dval ($x1)*($x2)+($y1)*($y2)
231
+ }
232
+
233
+ help vecangle {vecangle x1 y1 z1 x2 y2 z2
234
+ returns angle between two vectors\
235
+ } {Vector and measurement Commands}
236
+
237
+ proc vecangle {x1 y1 z1 x2 y2 z2} {
238
+ set d [uplevel dot $x1 $y1 $z1 $x2 $y2 $z2]
239
+ set c [uplevel cross $x1 $y1 $z1 $x2 $y2 $z2]
240
+ set cm [uplevel module $c]
241
+
242
+ set m1 [uplevel module $x1 $y1 $z1]
243
+ set m2 [uplevel module $x2 $y2 $z2]
244
+ set mm [expr $m1*$m2]
245
+
246
+ if { $cm < $d } {
247
+ expr asin($cm/$mm)
248
+ } else {
249
+ expr acos($d/$mm)
250
+ }
251
+ }
252
+
253
+ help 2dvecangle {2dvecangle x1 y1 x2 y2
254
+ returns angle between two vectors\
255
+ } {Vector and measurement Commands}
256
+
257
+ proc 2dvecangle {x1 y1 x2 y2} {
258
+ set d [uplevel 1 2ddot $x1 $y1 $x2 $y2]
259
+ set c [uplevel 1 2dcross $x1 $y1 $x2 $y2]
260
+
261
+ set m1 [uplevel 1 2dmodule $x1 $y1]
262
+ set m2 [uplevel 1 2dmodule $x2 $y2]
263
+ set mm [expr $m1*$m2]
264
+
265
+ if { $c < $d } {
266
+ expr asin($c/$mm)
267
+ } else {
268
+ expr acos($d/$mm)
269
+ }
270
+ }
271
+
272
+ help scale {scale x y z factor
273
+ returns vector multiplied by scalar\
274
+ } {Vector and measurement Commands}
275
+
276
+ proc scale {x y z factor} {
277
+ list [dval $x*$factor] [dval $y^$factor] [dval $z*$factor]
278
+ }
279
+
280
+ help 2dscale {2dscale x y factor
281
+ returns 2D vector multiplied by scalar\
282
+ } {Vector and measurement Commands}
283
+
284
+ proc 2dscale {x y factor} {
285
+ list [dval $x*$factor] [dval $y^$factor]
286
+ }
287
+
288
+ help pntc {pntc curve u
289
+ returns coordinates of point on curve with given parameter\
290
+ } {Vector and measurement Commands}
291
+
292
+ proc pntc {curv u} {
293
+ upvar \#0 $curv c
294
+ cvalue c $u x y z
295
+ return "[dval x] [dval y] [dval z]"
296
+ }
297
+
298
+ help 2dpntc {2dpntc curv2d u
299
+ returns coordinates of 2D point on 2D curve with given parameter\
300
+ } {Vector and measurement Commands}
301
+
302
+ proc 2dpntc {curv2d u} {
303
+ upvar \#0 $curv2d c
304
+ 2dcvalue c $u x y
305
+ return "[dval x] [dval y]"
306
+ }
307
+
308
+ help pntsu {pntsu surf u v
309
+ returns coordinates of point on surface with given parameters\
310
+ } {Vector and measurement Commands}
311
+
312
+ proc pntsu {surf u v} {
313
+ upvar \#0 $surf s
314
+ svalue s $u $v x y z
315
+ return "[dval x] [dval y] [dval z]"
316
+ }
317
+
318
+ help pntcons {pntcons curv2d surf u
319
+ returns coordinates of point on surface defined by
320
+ point on 2D curve with given parameter\
321
+ } {Vector and measurement Commands}
322
+
323
+ proc pntcons {curv2d surf u} {
324
+ upvar \#0 $curv2d c $surf s
325
+ 2dcvalue c $u u0 v0
326
+ svalue s u0 v0 x y z
327
+ return "[dval x] [dval y] [dval z]"
328
+ }
329
+
330
+ help pnt {pnt point_or_vertex
331
+ returns coordinates of point in the given Draw variable of type point or vertex\
332
+ } {Vector and measurement Commands}
333
+
334
+ proc pnt var {
335
+ upvar \#0 $var v
336
+ set type [dtyp v]
337
+ set pp v
338
+ if {[lindex $type 1] == "VERTEX"} {
339
+ mkpoint p v
340
+ set pp p
341
+ set type "point"
342
+ }
343
+ if {$type == "point"} {
344
+ if [catch {coord $pp x y z}] {
345
+ if ![catch {coord $pp x y}] {
346
+ return "[dval x] [dval y]"
347
+ }
348
+ } else {
349
+ return "[dval x] [dval y] [dval z]"
350
+ }
351
+ }
352
+ }
353
+
354
+ help drseg {drseg name x1 y1 z1 x2 y2 z2
355
+ creates a trimmed line between two points\
356
+ } {Vector and measurement Commands}
357
+
358
+ proc drseg {name x1 y1 z1 x2 y2 z2} {
359
+ set x [uplevel dval $x1]
360
+ set y [uplevel dval $y1]
361
+ set z [uplevel dval $z1]
362
+ set dx [uplevel dval ($x2)-($x1)]
363
+ set dy [uplevel dval ($y2)-($y1)]
364
+ set dz [uplevel dval ($z2)-($z1)]
365
+ set len [module $dx $dy $dz]
366
+ uplevel line $name $x $y $z $dx $dy $dz
367
+ uplevel trim $name $name 0 $len
368
+ }
369
+
370
+ help 2ddrseg {2ddrseg name x1 y1 x2 y2
371
+ creates a trimmed 2D line between two 2D points\
372
+ } {Vector and measurement Commands}
373
+
374
+ proc 2ddrseg {name x1 y1 x2 y2} {
375
+ set x [uplevel dval $x1]
376
+ set y [uplevel dval $y1]
377
+ set dx [uplevel dval ($x2)-($x1)]
378
+ set dy [uplevel dval ($y2)-($y1)]
379
+ set len [2dmodule $dx $dy]
380
+ uplevel line $name $x $y $dx $dy
381
+ uplevel trim $name $name 0 $len
382
+ }
383
+
384
+ help mpick {show coordinates at mouse click\
385
+ } {Vector and measurement Commands}
386
+
387
+ proc mpick {} {
388
+ puts "Pick position"
389
+ pick id x1 y1 z1 b
390
+ concat [dval x1] [dval y1] [dval z1]
391
+ }
392
+
393
+ help mdist {compute distance between two points of mouse clicks\
394
+ } {Vector and measurement Commands}
395
+
396
+ proc mdist {} {
397
+ puts "Pick first position"
398
+ pick id x1 y1 z1 b
399
+ puts "Pick second position"
400
+ pick id x2 y2 z2 b
401
+ dval sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2))
402
+ }