netgen-mesher 6.2.2506.post35.dev0__cp314-cp314-win_amd64.whl
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.
- netgen/NgOCC.py +7 -0
- netgen/__init__.py +114 -0
- netgen/__init__.pyi +22 -0
- netgen/__main__.py +53 -0
- netgen/cmake/NetgenConfig.cmake +79 -0
- netgen/cmake/netgen-targets-release.cmake +69 -0
- netgen/cmake/netgen-targets.cmake +146 -0
- netgen/config/__init__.py +1 -0
- netgen/config/__init__.pyi +52 -0
- netgen/config/__main__.py +4 -0
- netgen/config/config.py +68 -0
- netgen/config/config.pyi +54 -0
- netgen/csg.py +25 -0
- netgen/geom2d.py +178 -0
- netgen/gui.py +82 -0
- netgen/include/core/archive.hpp +1256 -0
- netgen/include/core/array.hpp +1760 -0
- netgen/include/core/autodiff.hpp +1131 -0
- netgen/include/core/autodiffdiff.hpp +733 -0
- netgen/include/core/bitarray.hpp +240 -0
- netgen/include/core/concurrentqueue.h +3619 -0
- netgen/include/core/exception.hpp +145 -0
- netgen/include/core/flags.hpp +199 -0
- netgen/include/core/hashtable.hpp +1281 -0
- netgen/include/core/localheap.hpp +318 -0
- netgen/include/core/logging.hpp +117 -0
- netgen/include/core/memtracer.hpp +221 -0
- netgen/include/core/mpi4py_pycapi.h +245 -0
- netgen/include/core/mpi_wrapper.hpp +643 -0
- netgen/include/core/ng_mpi.hpp +94 -0
- netgen/include/core/ng_mpi_generated_declarations.hpp +155 -0
- netgen/include/core/ng_mpi_native.hpp +25 -0
- netgen/include/core/ngcore.hpp +32 -0
- netgen/include/core/ngcore_api.hpp +152 -0
- netgen/include/core/ngstream.hpp +115 -0
- netgen/include/core/paje_trace.hpp +279 -0
- netgen/include/core/profiler.hpp +382 -0
- netgen/include/core/python_ngcore.hpp +457 -0
- netgen/include/core/ranges.hpp +109 -0
- netgen/include/core/register_archive.hpp +100 -0
- netgen/include/core/signal.hpp +82 -0
- netgen/include/core/simd.hpp +160 -0
- netgen/include/core/simd_arm64.hpp +407 -0
- netgen/include/core/simd_avx.hpp +394 -0
- netgen/include/core/simd_avx512.hpp +285 -0
- netgen/include/core/simd_generic.hpp +1053 -0
- netgen/include/core/simd_math.hpp +178 -0
- netgen/include/core/simd_sse.hpp +289 -0
- netgen/include/core/statushandler.hpp +37 -0
- netgen/include/core/symboltable.hpp +153 -0
- netgen/include/core/table.hpp +810 -0
- netgen/include/core/taskmanager.hpp +1161 -0
- netgen/include/core/type_traits.hpp +65 -0
- netgen/include/core/utils.hpp +385 -0
- netgen/include/core/version.hpp +102 -0
- netgen/include/core/xbool.hpp +47 -0
- netgen/include/csg/algprim.hpp +563 -0
- netgen/include/csg/brick.hpp +150 -0
- netgen/include/csg/csg.hpp +43 -0
- netgen/include/csg/csgeom.hpp +389 -0
- netgen/include/csg/csgparser.hpp +101 -0
- netgen/include/csg/curve2d.hpp +67 -0
- netgen/include/csg/edgeflw.hpp +112 -0
- netgen/include/csg/explicitcurve2d.hpp +113 -0
- netgen/include/csg/extrusion.hpp +185 -0
- netgen/include/csg/gencyl.hpp +70 -0
- netgen/include/csg/geoml.hpp +16 -0
- netgen/include/csg/identify.hpp +213 -0
- netgen/include/csg/manifold.hpp +29 -0
- netgen/include/csg/meshsurf.hpp +46 -0
- netgen/include/csg/polyhedra.hpp +121 -0
- netgen/include/csg/revolution.hpp +180 -0
- netgen/include/csg/singularref.hpp +84 -0
- netgen/include/csg/solid.hpp +295 -0
- netgen/include/csg/specpoin.hpp +194 -0
- netgen/include/csg/spline3d.hpp +99 -0
- netgen/include/csg/splinesurface.hpp +85 -0
- netgen/include/csg/surface.hpp +394 -0
- netgen/include/csg/triapprox.hpp +63 -0
- netgen/include/csg/vscsg.hpp +34 -0
- netgen/include/general/autodiff.hpp +356 -0
- netgen/include/general/autoptr.hpp +39 -0
- netgen/include/general/gzstream.h +121 -0
- netgen/include/general/hashtabl.hpp +1692 -0
- netgen/include/general/myadt.hpp +48 -0
- netgen/include/general/mystring.hpp +226 -0
- netgen/include/general/netgenout.hpp +205 -0
- netgen/include/general/ngarray.hpp +797 -0
- netgen/include/general/ngbitarray.hpp +149 -0
- netgen/include/general/ngpython.hpp +74 -0
- netgen/include/general/optmem.hpp +44 -0
- netgen/include/general/parthreads.hpp +138 -0
- netgen/include/general/seti.hpp +50 -0
- netgen/include/general/sort.hpp +47 -0
- netgen/include/general/spbita2d.hpp +59 -0
- netgen/include/general/stack.hpp +114 -0
- netgen/include/general/table.hpp +280 -0
- netgen/include/general/template.hpp +509 -0
- netgen/include/geom2d/csg2d.hpp +750 -0
- netgen/include/geom2d/geometry2d.hpp +280 -0
- netgen/include/geom2d/spline2d.hpp +234 -0
- netgen/include/geom2d/vsgeom2d.hpp +28 -0
- netgen/include/gprim/adtree.hpp +1392 -0
- netgen/include/gprim/geom2d.hpp +858 -0
- netgen/include/gprim/geom3d.hpp +749 -0
- netgen/include/gprim/geomfuncs.hpp +212 -0
- netgen/include/gprim/geomobjects.hpp +544 -0
- netgen/include/gprim/geomops.hpp +404 -0
- netgen/include/gprim/geomtest3d.hpp +101 -0
- netgen/include/gprim/gprim.hpp +33 -0
- netgen/include/gprim/spline.hpp +778 -0
- netgen/include/gprim/splinegeometry.hpp +73 -0
- netgen/include/gprim/transform3d.hpp +216 -0
- netgen/include/include/acisgeom.hpp +3 -0
- netgen/include/include/csg.hpp +1 -0
- netgen/include/include/geometry2d.hpp +1 -0
- netgen/include/include/gprim.hpp +1 -0
- netgen/include/include/incopengl.hpp +62 -0
- netgen/include/include/inctcl.hpp +13 -0
- netgen/include/include/incvis.hpp +6 -0
- netgen/include/include/linalg.hpp +1 -0
- netgen/include/include/meshing.hpp +1 -0
- netgen/include/include/myadt.hpp +1 -0
- netgen/include/include/mydefs.hpp +70 -0
- netgen/include/include/mystdlib.h +59 -0
- netgen/include/include/netgen_config.hpp +27 -0
- netgen/include/include/netgen_version.hpp +9 -0
- netgen/include/include/nginterface_v2_impl.hpp +395 -0
- netgen/include/include/ngsimd.hpp +1 -0
- netgen/include/include/occgeom.hpp +1 -0
- netgen/include/include/opti.hpp +1 -0
- netgen/include/include/parallel.hpp +1 -0
- netgen/include/include/stlgeom.hpp +1 -0
- netgen/include/include/visual.hpp +1 -0
- netgen/include/interface/rw_medit.hpp +11 -0
- netgen/include/interface/writeuser.hpp +80 -0
- netgen/include/linalg/densemat.hpp +414 -0
- netgen/include/linalg/linalg.hpp +29 -0
- netgen/include/linalg/opti.hpp +142 -0
- netgen/include/linalg/polynomial.hpp +47 -0
- netgen/include/linalg/vector.hpp +217 -0
- netgen/include/meshing/adfront2.hpp +274 -0
- netgen/include/meshing/adfront3.hpp +332 -0
- netgen/include/meshing/basegeom.hpp +370 -0
- netgen/include/meshing/bcfunctions.hpp +53 -0
- netgen/include/meshing/bisect.hpp +72 -0
- netgen/include/meshing/boundarylayer.hpp +113 -0
- netgen/include/meshing/classifyhpel.hpp +1984 -0
- netgen/include/meshing/clusters.hpp +46 -0
- netgen/include/meshing/curvedelems.hpp +274 -0
- netgen/include/meshing/delaunay2d.hpp +73 -0
- netgen/include/meshing/fieldlines.hpp +103 -0
- netgen/include/meshing/findip.hpp +198 -0
- netgen/include/meshing/findip2.hpp +103 -0
- netgen/include/meshing/geomsearch.hpp +69 -0
- netgen/include/meshing/global.hpp +54 -0
- netgen/include/meshing/hpref_hex.hpp +330 -0
- netgen/include/meshing/hpref_prism.hpp +3405 -0
- netgen/include/meshing/hpref_pyramid.hpp +154 -0
- netgen/include/meshing/hpref_quad.hpp +2082 -0
- netgen/include/meshing/hpref_segm.hpp +122 -0
- netgen/include/meshing/hpref_tet.hpp +4230 -0
- netgen/include/meshing/hpref_trig.hpp +848 -0
- netgen/include/meshing/hprefinement.hpp +366 -0
- netgen/include/meshing/improve2.hpp +178 -0
- netgen/include/meshing/improve3.hpp +151 -0
- netgen/include/meshing/localh.hpp +223 -0
- netgen/include/meshing/meshclass.hpp +1076 -0
- netgen/include/meshing/meshfunc.hpp +47 -0
- netgen/include/meshing/meshing.hpp +63 -0
- netgen/include/meshing/meshing2.hpp +163 -0
- netgen/include/meshing/meshing3.hpp +123 -0
- netgen/include/meshing/meshtool.hpp +90 -0
- netgen/include/meshing/meshtype.hpp +1930 -0
- netgen/include/meshing/msghandler.hpp +62 -0
- netgen/include/meshing/paralleltop.hpp +172 -0
- netgen/include/meshing/python_mesh.hpp +206 -0
- netgen/include/meshing/ruler2.hpp +172 -0
- netgen/include/meshing/ruler3.hpp +211 -0
- netgen/include/meshing/soldata.hpp +141 -0
- netgen/include/meshing/specials.hpp +17 -0
- netgen/include/meshing/surfacegeom.hpp +73 -0
- netgen/include/meshing/topology.hpp +1003 -0
- netgen/include/meshing/validate.hpp +21 -0
- netgen/include/meshing/visual_interface.hpp +71 -0
- netgen/include/mydefs.hpp +70 -0
- netgen/include/nginterface.h +474 -0
- netgen/include/nginterface_v2.hpp +406 -0
- netgen/include/nglib.h +697 -0
- netgen/include/nglib_occ.h +50 -0
- netgen/include/occ/occ_edge.hpp +47 -0
- netgen/include/occ/occ_face.hpp +52 -0
- netgen/include/occ/occ_solid.hpp +23 -0
- netgen/include/occ/occ_utils.hpp +376 -0
- netgen/include/occ/occ_vertex.hpp +30 -0
- netgen/include/occ/occgeom.hpp +659 -0
- netgen/include/occ/occmeshsurf.hpp +168 -0
- netgen/include/occ/vsocc.hpp +33 -0
- netgen/include/pybind11/LICENSE +29 -0
- netgen/include/pybind11/attr.h +722 -0
- netgen/include/pybind11/buffer_info.h +208 -0
- netgen/include/pybind11/cast.h +2361 -0
- netgen/include/pybind11/chrono.h +228 -0
- netgen/include/pybind11/common.h +2 -0
- netgen/include/pybind11/complex.h +74 -0
- netgen/include/pybind11/conduit/README.txt +15 -0
- netgen/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
- netgen/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
- netgen/include/pybind11/conduit/wrap_include_python_h.h +72 -0
- netgen/include/pybind11/critical_section.h +56 -0
- netgen/include/pybind11/detail/class.h +823 -0
- netgen/include/pybind11/detail/common.h +1348 -0
- netgen/include/pybind11/detail/cpp_conduit.h +75 -0
- netgen/include/pybind11/detail/descr.h +226 -0
- netgen/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
- netgen/include/pybind11/detail/exception_translation.h +71 -0
- netgen/include/pybind11/detail/function_record_pyobject.h +191 -0
- netgen/include/pybind11/detail/init.h +538 -0
- netgen/include/pybind11/detail/internals.h +799 -0
- netgen/include/pybind11/detail/native_enum_data.h +209 -0
- netgen/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
- netgen/include/pybind11/detail/struct_smart_holder.h +378 -0
- netgen/include/pybind11/detail/type_caster_base.h +1591 -0
- netgen/include/pybind11/detail/typeid.h +65 -0
- netgen/include/pybind11/detail/using_smart_holder.h +22 -0
- netgen/include/pybind11/detail/value_and_holder.h +90 -0
- netgen/include/pybind11/eigen/common.h +9 -0
- netgen/include/pybind11/eigen/matrix.h +723 -0
- netgen/include/pybind11/eigen/tensor.h +521 -0
- netgen/include/pybind11/eigen.h +12 -0
- netgen/include/pybind11/embed.h +320 -0
- netgen/include/pybind11/eval.h +161 -0
- netgen/include/pybind11/functional.h +147 -0
- netgen/include/pybind11/gil.h +199 -0
- netgen/include/pybind11/gil_safe_call_once.h +102 -0
- netgen/include/pybind11/gil_simple.h +37 -0
- netgen/include/pybind11/iostream.h +265 -0
- netgen/include/pybind11/native_enum.h +67 -0
- netgen/include/pybind11/numpy.h +2312 -0
- netgen/include/pybind11/operators.h +202 -0
- netgen/include/pybind11/options.h +92 -0
- netgen/include/pybind11/pybind11.h +3645 -0
- netgen/include/pybind11/pytypes.h +2680 -0
- netgen/include/pybind11/stl/filesystem.h +114 -0
- netgen/include/pybind11/stl.h +666 -0
- netgen/include/pybind11/stl_bind.h +858 -0
- netgen/include/pybind11/subinterpreter.h +299 -0
- netgen/include/pybind11/trampoline_self_life_support.h +65 -0
- netgen/include/pybind11/type_caster_pyobject_ptr.h +61 -0
- netgen/include/pybind11/typing.h +298 -0
- netgen/include/pybind11/warnings.h +75 -0
- netgen/include/stlgeom/meshstlsurface.hpp +67 -0
- netgen/include/stlgeom/stlgeom.hpp +491 -0
- netgen/include/stlgeom/stlline.hpp +193 -0
- netgen/include/stlgeom/stltool.hpp +331 -0
- netgen/include/stlgeom/stltopology.hpp +419 -0
- netgen/include/stlgeom/vsstl.hpp +58 -0
- netgen/include/visualization/meshdoc.hpp +42 -0
- netgen/include/visualization/mvdraw.hpp +325 -0
- netgen/include/visualization/vispar.hpp +128 -0
- netgen/include/visualization/visual.hpp +28 -0
- netgen/include/visualization/visual_api.hpp +10 -0
- netgen/include/visualization/vssolution.hpp +399 -0
- netgen/lib/libnggui.lib +0 -0
- netgen/lib/ngcore.lib +0 -0
- netgen/lib/nglib.lib +0 -0
- netgen/lib/togl.lib +0 -0
- netgen/libnggui.dll +0 -0
- netgen/libngguipy.lib +0 -0
- netgen/libngguipy.pyd +0 -0
- netgen/libngpy/_NgOCC.pyi +1545 -0
- netgen/libngpy/__init__.pyi +7 -0
- netgen/libngpy/_csg.pyi +259 -0
- netgen/libngpy/_geom2d.pyi +323 -0
- netgen/libngpy/_meshing.pyi +1111 -0
- netgen/libngpy/_stl.pyi +131 -0
- netgen/libngpy.lib +0 -0
- netgen/libngpy.pyd +0 -0
- netgen/meshing.py +65 -0
- netgen/ngcore.dll +0 -0
- netgen/nglib.dll +0 -0
- netgen/occ.py +52 -0
- netgen/read_gmsh.py +259 -0
- netgen/read_meshio.py +22 -0
- netgen/stl.py +2 -0
- netgen/togl.dll +0 -0
- netgen/version.py +2 -0
- netgen/webgui.py +529 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boundarycondition.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boxcyl.geo +32 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/circle_on_cube.geo +27 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cone.geo +13 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cube.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandring.geo +55 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandspheres.geo +21 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemcyl.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemsphere.geo +19 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylinder.geo +12 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylsphere.geo +12 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/doc/ng4.pdf +0 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipsoid.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipticcyl.geo +10 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/extrusion.geo +99 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/fichera.geo +24 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/frame.step +11683 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/hinge.stl +8486 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/lshape3d.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes2.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/matrix.geo +27 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ortho.geo +11 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/part1.stl +2662 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/period.geo +33 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/exportNeutral.py +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/mesh.py +19 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/shaft.geo +65 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/revolution.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/screw.step +1694 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sculpture.geo +13 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shaft.geo +65 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shell.geo +10 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphere.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphereincube.geo +17 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/square.in2d +35 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarecircle.in2d +48 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarehole.in2d +47 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/torus.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/trafo.geo +57 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twobricks.geo +15 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocubes.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocyl.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/METADATA +15 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/RECORD +340 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/WHEEL +5 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/entry_points.txt +2 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/AUTHORS +1 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/LICENSE +504 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/top_level.txt +2 -0
- pyngcore/__init__.py +1 -0
- pyngcore/pyngcore.cp314-win_amd64.pyd +0 -0
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
#ifndef FILE_GEOM3D
|
|
2
|
+
#define FILE_GEOM3D
|
|
3
|
+
|
|
4
|
+
/* *************************************************************************/
|
|
5
|
+
/* File: geom3d.hh */
|
|
6
|
+
/* Author: Joachim Schoeberl */
|
|
7
|
+
/* Date: 5. Aug. 95 */
|
|
8
|
+
/* *************************************************************************/
|
|
9
|
+
|
|
10
|
+
#include <mydefs.hpp>
|
|
11
|
+
#include "geom2d.hpp"
|
|
12
|
+
|
|
13
|
+
namespace netgen
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
extern DLL_HEADER void MyError (const char * ch);
|
|
18
|
+
|
|
19
|
+
class Point3d;
|
|
20
|
+
class Vec3d;
|
|
21
|
+
|
|
22
|
+
inline Vec3d operator- (const Point3d & p1, const Point3d & p2);
|
|
23
|
+
inline Point3d operator- (const Point3d & p1, const Vec3d & v);
|
|
24
|
+
inline Point3d operator+ (const Point3d & p1, const Vec3d & v);
|
|
25
|
+
Point3d & Add (double d, const Vec3d & v);
|
|
26
|
+
Point3d & Add2 (double d, const Vec3d & v,
|
|
27
|
+
double d2, const Vec3d & v2);
|
|
28
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2);
|
|
29
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2, const Point3d & p3);
|
|
30
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2,
|
|
31
|
+
const Point3d & p3, const Point3d & p4);
|
|
32
|
+
ostream & operator<<(ostream & s, const Point3d & p);
|
|
33
|
+
inline Vec3d operator- (const Vec3d & p1, const Vec3d & v);
|
|
34
|
+
inline Vec3d operator+ (const Vec3d & p1, const Vec3d & v);
|
|
35
|
+
inline Vec3d operator* (double scal, const Vec3d & v);
|
|
36
|
+
inline double operator* (const Vec3d & v1, const Vec3d & v2);
|
|
37
|
+
inline Vec3d Cross (const Vec3d & v1, const Vec3d & v2);
|
|
38
|
+
inline void Cross (const Vec3d & v1, const Vec3d & v2, Vec3d & prod);
|
|
39
|
+
double Angle (const Vec3d & v);
|
|
40
|
+
double FastAngle (const Vec3d & v);
|
|
41
|
+
double Angle (const Vec3d & v1, const Vec3d & v2);
|
|
42
|
+
double FastAngle (const Vec3d & v1, const Vec3d & v2);
|
|
43
|
+
ostream & operator<<(ostream & s, const Vec3d & v);
|
|
44
|
+
void Transpose (Vec3d & v1, Vec3d & v2, Vec3d & v3);
|
|
45
|
+
int SolveLinearSystem (const Vec3d & col1,
|
|
46
|
+
const Vec3d & col2,
|
|
47
|
+
const Vec3d & col3,
|
|
48
|
+
const Vec3d & rhs,
|
|
49
|
+
Vec3d & sol);
|
|
50
|
+
int SolveLinearSystemLS (const Vec3d & col1,
|
|
51
|
+
const Vec3d & col2,
|
|
52
|
+
const Vec2d & rhs,
|
|
53
|
+
Vec3d & sol);
|
|
54
|
+
int SolveLinearSystemLS2 (const Vec3d & col1,
|
|
55
|
+
const Vec3d & col2,
|
|
56
|
+
const Vec2d & rhs,
|
|
57
|
+
Vec3d & sol,
|
|
58
|
+
double & x, double & y);
|
|
59
|
+
int PseudoInverse (const Vec3d & col1,
|
|
60
|
+
const Vec3d & col2,
|
|
61
|
+
Vec3d & inv1,
|
|
62
|
+
Vec3d & inv2);
|
|
63
|
+
double Determinant (const Vec3d & col1,
|
|
64
|
+
const Vec3d & col2,
|
|
65
|
+
const Vec3d & col3);
|
|
66
|
+
|
|
67
|
+
inline double Dist2 (const Point3d & p1, const Point3d & p2);
|
|
68
|
+
|
|
69
|
+
/// Point in R3
|
|
70
|
+
class Point3d
|
|
71
|
+
{
|
|
72
|
+
protected:
|
|
73
|
+
///
|
|
74
|
+
double x[3];
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
///
|
|
78
|
+
Point3d () { x[0] = x[1] = x[2] = 0; }
|
|
79
|
+
///
|
|
80
|
+
Point3d(double ax, double ay, double az)
|
|
81
|
+
{ x[0] = ax; x[1] = ay; x[2] = az; }
|
|
82
|
+
///
|
|
83
|
+
Point3d(double ax[3])
|
|
84
|
+
{ x[0] = ax[0]; x[1] = ax[1]; x[2] = ax[2]; }
|
|
85
|
+
|
|
86
|
+
///
|
|
87
|
+
Point3d(const Point3d & p2)
|
|
88
|
+
{ x[0] = p2.x[0]; x[1] = p2.x[1]; x[2] = p2.x[2]; }
|
|
89
|
+
|
|
90
|
+
Point3d (const Point<3> & p2)
|
|
91
|
+
{
|
|
92
|
+
for (int i = 0; i < 3; i++)
|
|
93
|
+
x[i] = p2(i);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
///
|
|
97
|
+
Point3d & operator= (const Point3d & p2)
|
|
98
|
+
{ x[0] = p2.x[0]; x[1] = p2.x[1]; x[2] = p2.x[2]; return *this; }
|
|
99
|
+
|
|
100
|
+
///
|
|
101
|
+
int operator== (const Point3d& p) const
|
|
102
|
+
{ return (x[0] == p.x[0] && x[1] == p.x[1] && x[2] == p.x[2]); }
|
|
103
|
+
|
|
104
|
+
///
|
|
105
|
+
double & X() { return x[0]; }
|
|
106
|
+
///
|
|
107
|
+
double & Y() { return x[1]; }
|
|
108
|
+
///
|
|
109
|
+
double & Z() { return x[2]; }
|
|
110
|
+
///
|
|
111
|
+
double X() const { return x[0]; }
|
|
112
|
+
///
|
|
113
|
+
double Y() const { return x[1]; }
|
|
114
|
+
///
|
|
115
|
+
double Z() const { return x[2]; }
|
|
116
|
+
///
|
|
117
|
+
double & X(int i) { return x[i-1]; }
|
|
118
|
+
///
|
|
119
|
+
double X(int i) const { return x[i-1]; }
|
|
120
|
+
///
|
|
121
|
+
const Point3d & SetToMin (const Point3d & p2)
|
|
122
|
+
{
|
|
123
|
+
if (p2.x[0] < x[0]) x[0] = p2.x[0];
|
|
124
|
+
if (p2.x[1] < x[1]) x[1] = p2.x[1];
|
|
125
|
+
if (p2.x[2] < x[2]) x[2] = p2.x[2];
|
|
126
|
+
return *this;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
///
|
|
130
|
+
const Point3d & SetToMax (const Point3d & p2)
|
|
131
|
+
{
|
|
132
|
+
if (p2.x[0] > x[0]) x[0] = p2.x[0];
|
|
133
|
+
if (p2.x[1] > x[1]) x[1] = p2.x[1];
|
|
134
|
+
if (p2.x[2] > x[2]) x[2] = p2.x[2];
|
|
135
|
+
return *this;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
///
|
|
139
|
+
friend inline Vec3d operator- (const Point3d & p1, const Point3d & p2);
|
|
140
|
+
///
|
|
141
|
+
friend inline Point3d operator- (const Point3d & p1, const Vec3d & v);
|
|
142
|
+
///
|
|
143
|
+
friend inline Point3d operator+ (const Point3d & p1, const Vec3d & v);
|
|
144
|
+
///
|
|
145
|
+
inline Point3d & operator+= (const Vec3d & v);
|
|
146
|
+
inline Point3d & operator-= (const Vec3d & v);
|
|
147
|
+
///
|
|
148
|
+
inline Point3d & Add (double d, const Vec3d & v);
|
|
149
|
+
///
|
|
150
|
+
inline Point3d & Add2 (double d, const Vec3d & v,
|
|
151
|
+
double d2, const Vec3d & v2);
|
|
152
|
+
///
|
|
153
|
+
friend inline double Dist (const Point3d & p1, const Point3d & p2)
|
|
154
|
+
{ return sqrt ( (p1.x[0]-p2.x[0]) * (p1.x[0]-p2.x[0]) +
|
|
155
|
+
(p1.x[1]-p2.x[1]) * (p1.x[1]-p2.x[1]) +
|
|
156
|
+
(p1.x[2]-p2.x[2]) * (p1.x[2]-p2.x[2])); }
|
|
157
|
+
///
|
|
158
|
+
inline friend double Dist2 (const Point3d & p1, const Point3d & p2)
|
|
159
|
+
{ return ( (p1.x[0]-p2.x[0]) * (p1.x[0]-p2.x[0]) +
|
|
160
|
+
(p1.x[1]-p2.x[1]) * (p1.x[1]-p2.x[1]) +
|
|
161
|
+
(p1.x[2]-p2.x[2]) * (p1.x[2]-p2.x[2])); }
|
|
162
|
+
|
|
163
|
+
///
|
|
164
|
+
friend inline Point3d Center (const Point3d & p1, const Point3d & p2);
|
|
165
|
+
///
|
|
166
|
+
friend inline Point3d Center (const Point3d & p1, const Point3d & p2, const Point3d & p3);
|
|
167
|
+
///
|
|
168
|
+
friend inline Point3d Center (const Point3d & p1, const Point3d & p2,
|
|
169
|
+
const Point3d & p3, const Point3d & p4);
|
|
170
|
+
///
|
|
171
|
+
friend ostream & operator<<(ostream & s, const Point3d & p);
|
|
172
|
+
|
|
173
|
+
///
|
|
174
|
+
friend class Vec3d;
|
|
175
|
+
///
|
|
176
|
+
friend class Box3d;
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
operator Point<3> () const
|
|
180
|
+
{
|
|
181
|
+
return Point<3> (x[0], x[1], x[2]);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
///
|
|
187
|
+
class Vec3d
|
|
188
|
+
{
|
|
189
|
+
protected:
|
|
190
|
+
///
|
|
191
|
+
double x[3];
|
|
192
|
+
|
|
193
|
+
public:
|
|
194
|
+
///
|
|
195
|
+
inline Vec3d() { x[0] = x[1] = x[2] = 0; }
|
|
196
|
+
///
|
|
197
|
+
inline Vec3d(double ax, double ay, double az)
|
|
198
|
+
{ x[0] = ax; x[1] = ay; x[2] = az; }
|
|
199
|
+
///
|
|
200
|
+
Vec3d(double ax[3])
|
|
201
|
+
{ x[0] = ax[0]; x[1] = ax[1]; x[2] = ax[2]; }
|
|
202
|
+
///
|
|
203
|
+
inline Vec3d(const Vec3d & v2)
|
|
204
|
+
{ x[0] = v2.x[0]; x[1] = v2.x[1]; x[2] = v2.x[2]; }
|
|
205
|
+
///
|
|
206
|
+
inline Vec3d(const Point3d & p1, const Point3d & p2)
|
|
207
|
+
{
|
|
208
|
+
x[0] = p2.x[0] - p1.x[0];
|
|
209
|
+
x[1] = p2.x[1] - p1.x[1];
|
|
210
|
+
x[2] = p2.x[2] - p1.x[2];
|
|
211
|
+
}
|
|
212
|
+
///
|
|
213
|
+
inline Vec3d(const Point3d & p1)
|
|
214
|
+
{
|
|
215
|
+
x[0] = p1.x[0];
|
|
216
|
+
x[1] = p1.x[1];
|
|
217
|
+
x[2] = p1.x[2];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
Vec3d (const Vec<3> & v2)
|
|
221
|
+
{
|
|
222
|
+
for (int i = 0; i < 3; i++)
|
|
223
|
+
x[i] = v2(i);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
operator Vec<3> () const
|
|
227
|
+
{
|
|
228
|
+
return Vec<3> (x[0], x[1], x[2]);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
Vec3d & operator= (const Vec3d & v2)
|
|
233
|
+
{ x[0] = v2.x[0]; x[1] = v2.x[1]; x[2] = v2.x[2]; return *this; }
|
|
234
|
+
///
|
|
235
|
+
Vec3d & operator= (double val)
|
|
236
|
+
{ x[0] = x[1] = x[2] = val; return *this; }
|
|
237
|
+
///
|
|
238
|
+
double & X() { return x[0]; }
|
|
239
|
+
///
|
|
240
|
+
double & Y() { return x[1]; }
|
|
241
|
+
///
|
|
242
|
+
double & Z() { return x[2]; }
|
|
243
|
+
///
|
|
244
|
+
double & X(int i) { return x[i-1]; }
|
|
245
|
+
|
|
246
|
+
///
|
|
247
|
+
double X() const { return x[0]; }
|
|
248
|
+
///
|
|
249
|
+
double Y() const { return x[1]; }
|
|
250
|
+
///
|
|
251
|
+
double Z() const { return x[2]; }
|
|
252
|
+
///
|
|
253
|
+
double X(int i) const { return x[i-1]; }
|
|
254
|
+
|
|
255
|
+
///
|
|
256
|
+
double Length() const
|
|
257
|
+
{ return sqrt (x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); }
|
|
258
|
+
///
|
|
259
|
+
double Length2() const
|
|
260
|
+
{ return x[0] * x[0] + x[1] * x[1] + x[2] * x[2]; }
|
|
261
|
+
|
|
262
|
+
///
|
|
263
|
+
inline friend double Dist (const Vec3d & v1, const Vec3d & v2)
|
|
264
|
+
{ return sqrt ( (v1.x[0]-v2.x[0]) * (v1.x[0]-v2.x[0]) +
|
|
265
|
+
(v1.x[1]-v2.x[1]) * (v1.x[1]-v2.x[1]) +
|
|
266
|
+
(v1.x[2]-v2.x[2]) * (v1.x[2]-v2.x[2])); }
|
|
267
|
+
///
|
|
268
|
+
inline friend double Dist2 (const Vec3d & v1, const Vec3d & v2)
|
|
269
|
+
{ return ( (v1.x[0]-v2.x[0]) * (v1.x[0]-v2.x[0]) +
|
|
270
|
+
(v1.x[1]-v2.x[1]) * (v1.x[1]-v2.x[1]) +
|
|
271
|
+
(v1.x[2]-v2.x[2]) * (v1.x[2]-v2.x[2])); }
|
|
272
|
+
|
|
273
|
+
///
|
|
274
|
+
Vec3d & operator+= (const Vec3d & v2);
|
|
275
|
+
///
|
|
276
|
+
Vec3d & operator-= (const Vec3d & v2);
|
|
277
|
+
///
|
|
278
|
+
Vec3d & operator*= (double s);
|
|
279
|
+
///
|
|
280
|
+
Vec3d & operator/= (double s);
|
|
281
|
+
///
|
|
282
|
+
inline Vec3d & Add (double d, const Vec3d & v);
|
|
283
|
+
///
|
|
284
|
+
inline Vec3d & Add2 (double d, const Vec3d & v,
|
|
285
|
+
double d2, const Vec3d & v2);
|
|
286
|
+
|
|
287
|
+
///
|
|
288
|
+
friend inline Vec3d operator- (const Point3d & p1, const Point3d & p2);
|
|
289
|
+
///
|
|
290
|
+
friend inline Point3d operator- (const Point3d & p1, const Vec3d & v);
|
|
291
|
+
///
|
|
292
|
+
friend inline Point3d operator+ (const Point3d & p1, const Vec3d & v);
|
|
293
|
+
///
|
|
294
|
+
friend inline Vec3d operator- (const Vec3d & p1, const Vec3d & v);
|
|
295
|
+
///
|
|
296
|
+
friend inline Vec3d operator+ (const Vec3d & p1, const Vec3d & v);
|
|
297
|
+
///
|
|
298
|
+
friend inline Vec3d operator* (double scal, const Vec3d & v);
|
|
299
|
+
|
|
300
|
+
///
|
|
301
|
+
friend inline double operator* (const Vec3d & v1, const Vec3d & v2);
|
|
302
|
+
///
|
|
303
|
+
friend inline Vec3d Cross (const Vec3d & v1, const Vec3d & v2);
|
|
304
|
+
///
|
|
305
|
+
friend inline void Cross (const Vec3d & v1, const Vec3d & v2, Vec3d & prod);
|
|
306
|
+
|
|
307
|
+
/// Returns one normal-vector to n
|
|
308
|
+
DLL_HEADER void GetNormal (Vec3d & n) const;
|
|
309
|
+
///
|
|
310
|
+
friend double Angle (const Vec3d & v);
|
|
311
|
+
///
|
|
312
|
+
friend double FastAngle (const Vec3d & v);
|
|
313
|
+
///
|
|
314
|
+
friend double Angle (const Vec3d & v1, const Vec3d & v2);
|
|
315
|
+
///
|
|
316
|
+
friend double FastAngle (const Vec3d & v1, const Vec3d & v2);
|
|
317
|
+
|
|
318
|
+
void Normalize()
|
|
319
|
+
{
|
|
320
|
+
double len = (x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
|
|
321
|
+
if (len == 0) return;
|
|
322
|
+
len = sqrt (len);
|
|
323
|
+
x[0] /= len; x[1] /= len; x[2] /= len;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
///
|
|
327
|
+
friend ostream & operator<<(ostream & s, const Vec3d & v);
|
|
328
|
+
|
|
329
|
+
///
|
|
330
|
+
friend class Point3d;
|
|
331
|
+
friend void Transpose (Vec3d & v1, Vec3d & v2, Vec3d & v3);
|
|
332
|
+
friend int SolveLinearSystem (const Vec3d & col1,
|
|
333
|
+
const Vec3d & col2,
|
|
334
|
+
const Vec3d & col3,
|
|
335
|
+
const Vec3d & rhs,
|
|
336
|
+
Vec3d & sol);
|
|
337
|
+
friend int SolveLinearSystemLS (const Vec3d & col1,
|
|
338
|
+
const Vec3d & col2,
|
|
339
|
+
const Vec2d & rhs,
|
|
340
|
+
Vec3d & sol);
|
|
341
|
+
friend int SolveLinearSystemLS2 (const Vec3d & col1,
|
|
342
|
+
const Vec3d & col2,
|
|
343
|
+
const Vec2d & rhs,
|
|
344
|
+
Vec3d & sol,
|
|
345
|
+
double & x, double & y);
|
|
346
|
+
friend int PseudoInverse (const Vec3d & col1,
|
|
347
|
+
const Vec3d & col2,
|
|
348
|
+
Vec3d & inv1,
|
|
349
|
+
Vec3d & inv2);
|
|
350
|
+
friend double Determinant (const Vec3d & col1,
|
|
351
|
+
const Vec3d & col2,
|
|
352
|
+
const Vec3d & col3);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
class QuadraticFunction3d
|
|
358
|
+
{
|
|
359
|
+
double c0, cx, cy, cz;
|
|
360
|
+
double cxx, cyy, czz, cxy, cxz, cyz;
|
|
361
|
+
|
|
362
|
+
public:
|
|
363
|
+
QuadraticFunction3d (const Point3d & p, const Vec3d & v);
|
|
364
|
+
double Eval (const Point3d & p)
|
|
365
|
+
{
|
|
366
|
+
return
|
|
367
|
+
c0
|
|
368
|
+
+ p.X() * (cx + cxx * p.X() + cxy * p.Y() + cxz * p.Z())
|
|
369
|
+
+ p.Y() * (cy + cyy * p.Y() + cyz * p.Z())
|
|
370
|
+
+ p.Z() * (cz + czz * p.Z());
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2)
|
|
377
|
+
{
|
|
378
|
+
return Point3d (0.5 * (p1.x[0] + p2.x[0]),
|
|
379
|
+
0.5 * (p1.x[1] + p2.x[1]),
|
|
380
|
+
0.5 * (p1.x[2] + p2.x[2]));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2,
|
|
385
|
+
const Point3d & p3)
|
|
386
|
+
{
|
|
387
|
+
return Point3d (1.0/3.0 * (p1.x[0] + p2.x[0] + p3.x[0]),
|
|
388
|
+
1.0/3.0 * (p1.x[1] + p2.x[1] + p3.x[1]),
|
|
389
|
+
1.0/3.0 * (p1.x[2] + p2.x[2] + p3.x[2]));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
inline Point3d Center (const Point3d & p1, const Point3d & p2,
|
|
393
|
+
const Point3d & p3, const Point3d & p4)
|
|
394
|
+
{
|
|
395
|
+
return Point3d (0.25 * (p1.x[0] + p2.x[0] + p3.x[0] + p4.x[0]),
|
|
396
|
+
0.25 * (p1.x[1] + p2.x[1] + p3.x[1] + p4.x[1]),
|
|
397
|
+
0.25 * (p1.x[2] + p2.x[2] + p3.x[2] + p4.x[2]));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
inline Vec3d & Vec3d :: operator+= (const Vec3d & v2)
|
|
403
|
+
{
|
|
404
|
+
x[0] += v2.x[0];
|
|
405
|
+
x[1] += v2.x[1];
|
|
406
|
+
x[2] += v2.x[2];
|
|
407
|
+
return *this;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
inline Vec3d & Vec3d :: operator-= (const Vec3d & v2)
|
|
411
|
+
{
|
|
412
|
+
x[0] -= v2.x[0];
|
|
413
|
+
x[1] -= v2.x[1];
|
|
414
|
+
x[2] -= v2.x[2];
|
|
415
|
+
return *this;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
inline Vec3d & Vec3d :: operator*= (double s)
|
|
420
|
+
{
|
|
421
|
+
x[0] *= s;
|
|
422
|
+
x[1] *= s;
|
|
423
|
+
x[2] *= s;
|
|
424
|
+
return *this;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
inline Vec3d & Vec3d :: operator/= (double s)
|
|
429
|
+
{
|
|
430
|
+
if (s != 0)
|
|
431
|
+
{
|
|
432
|
+
x[0] /= s;
|
|
433
|
+
x[1] /= s;
|
|
434
|
+
x[2] /= s;
|
|
435
|
+
}
|
|
436
|
+
#ifdef DEBUG
|
|
437
|
+
else
|
|
438
|
+
{
|
|
439
|
+
cerr << "Vec div by 0, v = " << (*this) << endl;
|
|
440
|
+
// MyError ("Vec3d::operator /=: Divisioin by zero");
|
|
441
|
+
}
|
|
442
|
+
#endif
|
|
443
|
+
return *this;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
inline Vec3d & Vec3d::Add (double d, const Vec3d & v)
|
|
447
|
+
{
|
|
448
|
+
x[0] += d * v.x[0];
|
|
449
|
+
x[1] += d * v.x[1];
|
|
450
|
+
x[2] += d * v.x[2];
|
|
451
|
+
return *this;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
inline Vec3d & Vec3d::Add2 (double d, const Vec3d & v,
|
|
455
|
+
double d2, const Vec3d & v2)
|
|
456
|
+
{
|
|
457
|
+
x[0] += d * v.x[0] + d2 * v2.x[0];
|
|
458
|
+
x[1] += d * v.x[1] + d2 * v2.x[1];
|
|
459
|
+
x[2] += d * v.x[2] + d2 * v2.x[2];
|
|
460
|
+
return *this;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
inline Vec3d operator- (const Point3d & p1, const Point3d & p2)
|
|
471
|
+
{
|
|
472
|
+
return Vec3d (p1.x[0] - p2.x[0], p1.x[1] - p2.x[1],p1.x[2] - p2.x[2]);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
inline Point3d operator- (const Point3d & p1, const Vec3d & v)
|
|
477
|
+
{
|
|
478
|
+
return Point3d (p1.x[0] - v.x[0], p1.x[1] - v.x[1],p1.x[2] - v.x[2]);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
inline Point3d operator+ (const Point3d & p1, const Vec3d & v)
|
|
483
|
+
{
|
|
484
|
+
return Point3d (p1.x[0] + v.x[0], p1.x[1] + v.x[1],p1.x[2] + v.x[2]);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
inline Point3d & Point3d::operator+= (const Vec3d & v)
|
|
488
|
+
{
|
|
489
|
+
x[0] += v.x[0];
|
|
490
|
+
x[1] += v.x[1];
|
|
491
|
+
x[2] += v.x[2];
|
|
492
|
+
return *this;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
inline Point3d & Point3d::operator-= (const Vec3d & v)
|
|
496
|
+
{
|
|
497
|
+
x[0] -= v.x[0];
|
|
498
|
+
x[1] -= v.x[1];
|
|
499
|
+
x[2] -= v.x[2];
|
|
500
|
+
return *this;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
inline Point3d & Point3d::Add (double d, const Vec3d & v)
|
|
504
|
+
{
|
|
505
|
+
x[0] += d * v.x[0];
|
|
506
|
+
x[1] += d * v.x[1];
|
|
507
|
+
x[2] += d * v.x[2];
|
|
508
|
+
return *this;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
inline Point3d & Point3d::Add2 (double d, const Vec3d & v,
|
|
512
|
+
double d2, const Vec3d & v2)
|
|
513
|
+
{
|
|
514
|
+
x[0] += d * v.x[0] + d2 * v2.x[0];
|
|
515
|
+
x[1] += d * v.x[1] + d2 * v2.x[1];
|
|
516
|
+
x[2] += d * v.x[2] + d2 * v2.x[2];
|
|
517
|
+
return *this;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
inline Vec3d operator- (const Vec3d & v1, const Vec3d & v2)
|
|
522
|
+
{
|
|
523
|
+
return Vec3d (v1.x[0] - v2.x[0], v1.x[1] - v2.x[1],v1.x[2] - v2.x[2]);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
inline Vec3d operator+ (const Vec3d & v1, const Vec3d & v2)
|
|
528
|
+
{
|
|
529
|
+
return Vec3d (v1.x[0] + v2.x[0], v1.x[1] + v2.x[1],v1.x[2] + v2.x[2]);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
inline Vec3d operator* (double scal, const Vec3d & v)
|
|
534
|
+
{
|
|
535
|
+
return Vec3d (scal * v.x[0], scal * v.x[1], scal * v.x[2]);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
inline double operator* (const Vec3d & v1, const Vec3d & v2)
|
|
541
|
+
{
|
|
542
|
+
return v1.x[0] * v2.x[0] + v1.x[1] * v2.x[1] + v1.x[2] * v2.x[2];
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
inline Vec3d Cross (const Vec3d & v1, const Vec3d & v2)
|
|
548
|
+
{
|
|
549
|
+
return Vec3d
|
|
550
|
+
( v1.x[1] * v2.x[2] - v1.x[2] * v2.x[1],
|
|
551
|
+
v1.x[2] * v2.x[0] - v1.x[0] * v2.x[2],
|
|
552
|
+
v1.x[0] * v2.x[1] - v1.x[1] * v2.x[0]);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
inline void Cross (const Vec3d & v1, const Vec3d & v2, Vec3d & prod)
|
|
556
|
+
{
|
|
557
|
+
prod.x[0] = v1.x[1] * v2.x[2] - v1.x[2] * v2.x[1];
|
|
558
|
+
prod.x[1] = v1.x[2] * v2.x[0] - v1.x[0] * v2.x[2];
|
|
559
|
+
prod.x[2] = v1.x[0] * v2.x[1] - v1.x[1] * v2.x[0];
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
inline double Determinant (const Vec3d & col1,
|
|
563
|
+
const Vec3d & col2,
|
|
564
|
+
const Vec3d & col3)
|
|
565
|
+
{
|
|
566
|
+
return
|
|
567
|
+
col1.x[0] * ( col2.x[1] * col3.x[2] - col2.x[2] * col3.x[1]) +
|
|
568
|
+
col1.x[1] * ( col2.x[2] * col3.x[0] - col2.x[0] * col3.x[2]) +
|
|
569
|
+
col1.x[2] * ( col2.x[0] * col3.x[1] - col2.x[1] * col3.x[0]);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
///
|
|
574
|
+
class Box3d
|
|
575
|
+
{
|
|
576
|
+
protected:
|
|
577
|
+
///
|
|
578
|
+
double minx[3], maxx[3];
|
|
579
|
+
|
|
580
|
+
public:
|
|
581
|
+
///
|
|
582
|
+
Box3d () { };
|
|
583
|
+
///
|
|
584
|
+
DLL_HEADER Box3d ( double aminx, double amaxx,
|
|
585
|
+
double aminy, double amaxy,
|
|
586
|
+
double aminz, double amaxz );
|
|
587
|
+
///
|
|
588
|
+
DLL_HEADER Box3d ( const Box3d & b2 );
|
|
589
|
+
///
|
|
590
|
+
DLL_HEADER Box3d (const Point3d& p1, const Point3d& p2);
|
|
591
|
+
///
|
|
592
|
+
DLL_HEADER Box3d (const Box<3> & b2);
|
|
593
|
+
///
|
|
594
|
+
double MinX () const { return minx[0]; }
|
|
595
|
+
///
|
|
596
|
+
double MaxX () const { return maxx[0]; }
|
|
597
|
+
///
|
|
598
|
+
double MinY () const { return minx[1]; }
|
|
599
|
+
///
|
|
600
|
+
double MaxY () const { return maxx[1]; }
|
|
601
|
+
///
|
|
602
|
+
double MinZ () const { return minx[2]; }
|
|
603
|
+
///
|
|
604
|
+
double MaxZ () const { return maxx[2]; }
|
|
605
|
+
|
|
606
|
+
///
|
|
607
|
+
double Mini (int i) const { return minx[i-1]; }
|
|
608
|
+
///
|
|
609
|
+
double Maxi (int i) const { return maxx[i-1]; }
|
|
610
|
+
|
|
611
|
+
///
|
|
612
|
+
Point3d PMin () const { return Point3d(minx[0], minx[1], minx[2]); }
|
|
613
|
+
///
|
|
614
|
+
Point3d PMax () const { return Point3d(maxx[0], maxx[1], maxx[2]); }
|
|
615
|
+
|
|
616
|
+
///
|
|
617
|
+
void GetPointNr (int i, Point3d & point) const;
|
|
618
|
+
/// increase Box at each side with dist
|
|
619
|
+
void Increase (double dist);
|
|
620
|
+
/// increase Box by factor rel
|
|
621
|
+
void IncreaseRel (double rel);
|
|
622
|
+
/// return 1 if closures are intersecting
|
|
623
|
+
int Intersect (const Box3d & box2) const
|
|
624
|
+
{
|
|
625
|
+
if (minx[0] > box2.maxx[0] || maxx[0] < box2.minx[0] ||
|
|
626
|
+
minx[1] > box2.maxx[1] || maxx[1] < box2.minx[1] ||
|
|
627
|
+
minx[2] > box2.maxx[2] || maxx[2] < box2.minx[2])
|
|
628
|
+
return 0;
|
|
629
|
+
return 1;
|
|
630
|
+
}
|
|
631
|
+
/// return 1 if point p in closure
|
|
632
|
+
int IsIn (const Point3d & p) const
|
|
633
|
+
{
|
|
634
|
+
if (minx[0] <= p.x[0] && maxx[0] >= p.x[0] &&
|
|
635
|
+
minx[1] <= p.x[1] && maxx[1] >= p.x[1] &&
|
|
636
|
+
minx[2] <= p.x[2] && maxx[2] >= p.x[2])
|
|
637
|
+
return 1;
|
|
638
|
+
return 0;
|
|
639
|
+
}
|
|
640
|
+
///
|
|
641
|
+
inline void SetPoint (const Point3d & p)
|
|
642
|
+
{
|
|
643
|
+
minx[0] = maxx[0] = p.X();
|
|
644
|
+
minx[1] = maxx[1] = p.Y();
|
|
645
|
+
minx[2] = maxx[2] = p.Z();
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
///
|
|
649
|
+
inline void AddPoint (const Point3d & p)
|
|
650
|
+
{
|
|
651
|
+
if (p.x[0] < minx[0]) minx[0] = p.x[0];
|
|
652
|
+
if (p.x[0] > maxx[0]) maxx[0] = p.x[0];
|
|
653
|
+
if (p.x[1] < minx[1]) minx[1] = p.x[1];
|
|
654
|
+
if (p.x[1] > maxx[1]) maxx[1] = p.x[1];
|
|
655
|
+
if (p.x[2] < minx[2]) minx[2] = p.x[2];
|
|
656
|
+
if (p.x[2] > maxx[2]) maxx[2] = p.x[2];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
///
|
|
660
|
+
const Box3d& operator+=(const Box3d& b);
|
|
661
|
+
|
|
662
|
+
///
|
|
663
|
+
Point3d MaxCoords() const;
|
|
664
|
+
///
|
|
665
|
+
Point3d MinCoords() const;
|
|
666
|
+
|
|
667
|
+
/// Make a negative sized box;
|
|
668
|
+
// void CreateNegMinMaxBox();
|
|
669
|
+
|
|
670
|
+
///
|
|
671
|
+
Point3d CalcCenter () const { return Point3d(0.5*(minx[0] + maxx[0]),
|
|
672
|
+
0.5*(minx[1] + maxx[1]),
|
|
673
|
+
0.5*(minx[2] + maxx[2])); }
|
|
674
|
+
///
|
|
675
|
+
double CalcDiam () const { return sqrt(sqr(maxx[0]-minx[0])+
|
|
676
|
+
sqr(maxx[1]-minx[1])+
|
|
677
|
+
sqr(maxx[2]-minx[2])); }
|
|
678
|
+
|
|
679
|
+
///
|
|
680
|
+
void WriteData(ofstream& fout) const;
|
|
681
|
+
///
|
|
682
|
+
void ReadData(ifstream& fin);
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
class Box3dSphere : public Box3d
|
|
687
|
+
{
|
|
688
|
+
protected:
|
|
689
|
+
///
|
|
690
|
+
double diam, inner;
|
|
691
|
+
///
|
|
692
|
+
Point3d c;
|
|
693
|
+
public:
|
|
694
|
+
///
|
|
695
|
+
Box3dSphere () { };
|
|
696
|
+
///
|
|
697
|
+
Box3dSphere ( double aminx, double amaxx,
|
|
698
|
+
double aminy, double amaxy,
|
|
699
|
+
double aminz, double amaxz);
|
|
700
|
+
///
|
|
701
|
+
const Point3d & Center () const { return c; }
|
|
702
|
+
|
|
703
|
+
///
|
|
704
|
+
double Diam () const { return diam; }
|
|
705
|
+
///
|
|
706
|
+
double Inner () const { return inner; }
|
|
707
|
+
///
|
|
708
|
+
void GetSubBox (int i, Box3dSphere & sbox) const;
|
|
709
|
+
|
|
710
|
+
// private:
|
|
711
|
+
///
|
|
712
|
+
void CalcDiamCenter ();
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
///
|
|
719
|
+
class referencetransform
|
|
720
|
+
{
|
|
721
|
+
///
|
|
722
|
+
Vec3d ex, ey, ez;
|
|
723
|
+
///
|
|
724
|
+
Vec3d exh, eyh, ezh;
|
|
725
|
+
///
|
|
726
|
+
Vec3d ex_h, ey_h, ez_h;
|
|
727
|
+
///
|
|
728
|
+
Point3d rp;
|
|
729
|
+
///
|
|
730
|
+
double h;
|
|
731
|
+
|
|
732
|
+
public:
|
|
733
|
+
|
|
734
|
+
///
|
|
735
|
+
void Set (const Point3d & p1, const Point3d & p2,
|
|
736
|
+
const Point3d & p3, double ah);
|
|
737
|
+
|
|
738
|
+
///
|
|
739
|
+
void ToPlain (const Point3d & p, Point3d & pp) const;
|
|
740
|
+
///
|
|
741
|
+
void ToPlain (const NgArray<Point3d> & p, NgArray<Point3d> & pp) const;
|
|
742
|
+
///
|
|
743
|
+
void FromPlain (const Point3d & pp, Point3d & p) const;
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
#endif
|