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,778 @@
|
|
|
1
|
+
#ifndef FILE_SPLINE_HPP
|
|
2
|
+
#define FILE_SPLINE_HPP
|
|
3
|
+
|
|
4
|
+
/**************************************************************************/
|
|
5
|
+
/* File: spline.hpp */
|
|
6
|
+
/* Author: Joachim Schoeberl */
|
|
7
|
+
/* Date: 24. Jul. 96 */
|
|
8
|
+
/**************************************************************************/
|
|
9
|
+
|
|
10
|
+
namespace netgen
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
Spline curves for 2D mesh generation
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/// Geometry point
|
|
21
|
+
template < int D >
|
|
22
|
+
class GeomPoint : public Point<D>
|
|
23
|
+
{
|
|
24
|
+
public:
|
|
25
|
+
/// refinement factor at point
|
|
26
|
+
double refatpoint;
|
|
27
|
+
/// max mesh-size at point
|
|
28
|
+
double hmax;
|
|
29
|
+
/// hp-refinement
|
|
30
|
+
double hpref;
|
|
31
|
+
///
|
|
32
|
+
string name;
|
|
33
|
+
///
|
|
34
|
+
GeomPoint () { ; }
|
|
35
|
+
|
|
36
|
+
///
|
|
37
|
+
GeomPoint (const Point<D> & ap, double aref = 1, double ahpref=0)
|
|
38
|
+
: Point<D>(ap), refatpoint(aref), hmax(1e99), hpref(ahpref) { ; }
|
|
39
|
+
void DoArchive(Archive& ar)
|
|
40
|
+
{
|
|
41
|
+
Point<D>::DoArchive(ar);
|
|
42
|
+
ar & refatpoint & hmax & hpref;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// base class for 2d - segment
|
|
50
|
+
template < int D >
|
|
51
|
+
class SplineSeg
|
|
52
|
+
{
|
|
53
|
+
double maxh;
|
|
54
|
+
string bcname;
|
|
55
|
+
public:
|
|
56
|
+
SplineSeg (double amaxh = 1e99, string abcname = "default")
|
|
57
|
+
: maxh(amaxh), bcname(abcname) { ; }
|
|
58
|
+
///
|
|
59
|
+
virtual ~SplineSeg() { ; }
|
|
60
|
+
/// calculates length of curve
|
|
61
|
+
virtual double Length () const;
|
|
62
|
+
/// returns point at curve, 0 <= t <= 1
|
|
63
|
+
virtual Point<D> GetPoint (double t) const = 0;
|
|
64
|
+
/// returns a (not necessarily unit-length) tangent vector for 0 <= t <= 1
|
|
65
|
+
virtual Vec<D> GetTangent (const double t) const
|
|
66
|
+
{
|
|
67
|
+
cerr << "GetTangent not implemented for spline base-class" << endl;
|
|
68
|
+
Vec<D> dummy; return dummy;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
virtual void GetDerivatives (const double t,
|
|
72
|
+
Point<D> & point,
|
|
73
|
+
Vec<D> & first,
|
|
74
|
+
Vec<D> & second) const
|
|
75
|
+
{
|
|
76
|
+
double eps = 1e-6;
|
|
77
|
+
point = GetPoint (t);
|
|
78
|
+
Point<D> pl = GetPoint (t-eps);
|
|
79
|
+
Point<D> pr = GetPoint (t+eps);
|
|
80
|
+
first = 1.0/(2*eps) * (pr-pl);
|
|
81
|
+
second = 1.0/sqr(eps) * ( (pr-point)+(pl-point));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
virtual void DoArchive(Archive& ar) = 0;
|
|
85
|
+
|
|
86
|
+
/// returns initial point on curve
|
|
87
|
+
virtual const GeomPoint<D> & StartPI () const = 0;
|
|
88
|
+
/// returns terminal point on curve
|
|
89
|
+
virtual const GeomPoint<D> & EndPI () const = 0;
|
|
90
|
+
/** writes curve description for fepp:
|
|
91
|
+
for implicitly given quadratic curves, the 6 coefficients of
|
|
92
|
+
the polynomial
|
|
93
|
+
$$ a x^2 + b y^2 + c x y + d x + e y + f = 0 $$
|
|
94
|
+
are written to ost */
|
|
95
|
+
void PrintCoeff (ostream & ost) const;
|
|
96
|
+
|
|
97
|
+
virtual void GetCoeff (Vector & coeffs) const = 0;
|
|
98
|
+
virtual void GetCoeff (Vector & coeffs, Point<D> p0) const { ; }
|
|
99
|
+
|
|
100
|
+
virtual void GetPoints (int n, NgArray<Point<D> > & points) const;
|
|
101
|
+
|
|
102
|
+
/** calculates (2D) lineintersections:
|
|
103
|
+
for lines $$ a x + b y + c = 0 $$ the intersecting points are calculated
|
|
104
|
+
and stored in points */
|
|
105
|
+
virtual void LineIntersections (const double a, const double b, const double c,
|
|
106
|
+
NgArray < Point<D> > & points, const double eps) const
|
|
107
|
+
{points.SetSize(0);}
|
|
108
|
+
|
|
109
|
+
// is the point in the convex hull (increased by eps) of the spline ?
|
|
110
|
+
virtual bool InConvexHull (Point<D> p, double eps) const = 0;
|
|
111
|
+
|
|
112
|
+
virtual double MaxCurvature(void) const = 0;
|
|
113
|
+
|
|
114
|
+
virtual string GetType(void) const {return "splinebase";}
|
|
115
|
+
|
|
116
|
+
virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const
|
|
117
|
+
{ cerr << "Project not implemented for spline base-class" << endl;}
|
|
118
|
+
|
|
119
|
+
virtual void GetRawData (NgArray<double> & data) const
|
|
120
|
+
{ cerr << "GetRawData not implemented for spline base-class" << endl;}
|
|
121
|
+
|
|
122
|
+
double GetMaxh() const { return maxh; }
|
|
123
|
+
string GetBCName() const { return bcname; }
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
/// Straight line form p1 to p2
|
|
128
|
+
template< int D >
|
|
129
|
+
class LineSeg : public SplineSeg<D>
|
|
130
|
+
{
|
|
131
|
+
///
|
|
132
|
+
GeomPoint<D> p1, p2;
|
|
133
|
+
public:
|
|
134
|
+
///
|
|
135
|
+
LineSeg (const GeomPoint<D> & ap1, const GeomPoint<D> & ap2,
|
|
136
|
+
double maxh=1e99, string bcname="default");
|
|
137
|
+
///
|
|
138
|
+
// default constructor for archive
|
|
139
|
+
LineSeg() {}
|
|
140
|
+
virtual void DoArchive(Archive& ar)
|
|
141
|
+
{
|
|
142
|
+
ar & p1 & p2;
|
|
143
|
+
}
|
|
144
|
+
virtual double Length () const;
|
|
145
|
+
///
|
|
146
|
+
inline virtual Point<D> GetPoint (double t) const;
|
|
147
|
+
///
|
|
148
|
+
virtual Vec<D> GetTangent (const double t) const;
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
virtual void GetDerivatives (const double t,
|
|
152
|
+
Point<D> & point,
|
|
153
|
+
Vec<D> & first,
|
|
154
|
+
Vec<D> & second) const;
|
|
155
|
+
///
|
|
156
|
+
virtual const GeomPoint<D> & StartPI () const { return p1; };
|
|
157
|
+
///
|
|
158
|
+
virtual const GeomPoint<D> & EndPI () const { return p2; }
|
|
159
|
+
///
|
|
160
|
+
virtual void GetCoeff (Vector & coeffs) const;
|
|
161
|
+
virtual void GetCoeff (Vector & coeffs, Point<D> p0) const;
|
|
162
|
+
|
|
163
|
+
virtual string GetType(void) const {return "line";}
|
|
164
|
+
|
|
165
|
+
virtual void LineIntersections (const double a, const double b, const double c,
|
|
166
|
+
NgArray < Point<D> > & points, const double eps) const;
|
|
167
|
+
|
|
168
|
+
virtual bool InConvexHull (Point<D> p, double eps) const
|
|
169
|
+
{
|
|
170
|
+
return MinDistLP2 (p1, p2, p) < sqr(eps);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
virtual double MaxCurvature(void) const {return 0;}
|
|
174
|
+
|
|
175
|
+
virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const;
|
|
176
|
+
|
|
177
|
+
virtual void GetRawData (NgArray<double> & data) const;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
/// curve given by a rational, quadratic spline (including ellipses)
|
|
182
|
+
template< int D >
|
|
183
|
+
class SplineSeg3 : public SplineSeg<D>
|
|
184
|
+
{
|
|
185
|
+
///
|
|
186
|
+
GeomPoint<D> p1, p2, p3;
|
|
187
|
+
double weight;
|
|
188
|
+
mutable double proj_latest_t;
|
|
189
|
+
public:
|
|
190
|
+
///
|
|
191
|
+
DLL_HEADER SplineSeg3 (const GeomPoint<D> & ap1,
|
|
192
|
+
const GeomPoint<D> & ap2,
|
|
193
|
+
const GeomPoint<D> & ap3,
|
|
194
|
+
string bcname="default",
|
|
195
|
+
double maxh=1e99);
|
|
196
|
+
DLL_HEADER SplineSeg3 (const GeomPoint<D> & ap1,
|
|
197
|
+
const GeomPoint<D> & ap2,
|
|
198
|
+
const GeomPoint<D> & ap3,
|
|
199
|
+
double aweight,
|
|
200
|
+
string bcname="default",
|
|
201
|
+
double maxh=1e99);
|
|
202
|
+
// default constructor for archive
|
|
203
|
+
SplineSeg3() {}
|
|
204
|
+
///
|
|
205
|
+
virtual void DoArchive(Archive& ar)
|
|
206
|
+
{
|
|
207
|
+
ar & p1 & p2 & p3 & weight & proj_latest_t;
|
|
208
|
+
}
|
|
209
|
+
///
|
|
210
|
+
double GetWeight () const { return weight; }
|
|
211
|
+
void SetWeight (double w) { weight = w; }
|
|
212
|
+
///
|
|
213
|
+
DLL_HEADER virtual Point<D> GetPoint (double t) const;
|
|
214
|
+
///
|
|
215
|
+
DLL_HEADER virtual Vec<D> GetTangent (const double t) const;
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
DLL_HEADER virtual void GetDerivatives (const double t,
|
|
219
|
+
Point<D> & point,
|
|
220
|
+
Vec<D> & first,
|
|
221
|
+
Vec<D> & second) const;
|
|
222
|
+
///
|
|
223
|
+
DLL_HEADER virtual const GeomPoint<D> & StartPI () const { return p1; };
|
|
224
|
+
///
|
|
225
|
+
DLL_HEADER virtual const GeomPoint<D> & EndPI () const { return p3; }
|
|
226
|
+
///
|
|
227
|
+
DLL_HEADER virtual void GetCoeff (Vector & coeffs) const;
|
|
228
|
+
DLL_HEADER virtual void GetCoeff (Vector & coeffs, Point<D> p0) const;
|
|
229
|
+
|
|
230
|
+
virtual string GetType(void) const {return "spline3";}
|
|
231
|
+
|
|
232
|
+
const GeomPoint<D> & TangentPoint (void) const { return p2; }
|
|
233
|
+
|
|
234
|
+
DLL_HEADER virtual void LineIntersections (const double a, const double b, const double c,
|
|
235
|
+
NgArray < Point<D> > & points, const double eps) const;
|
|
236
|
+
|
|
237
|
+
virtual bool InConvexHull (Point<D> p, double eps) const
|
|
238
|
+
{
|
|
239
|
+
return MinDistTP2 (p1, p2, p3, p) < sqr(eps);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
DLL_HEADER virtual double MaxCurvature(void) const;
|
|
243
|
+
|
|
244
|
+
DLL_HEADER virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const;
|
|
245
|
+
|
|
246
|
+
DLL_HEADER virtual void GetRawData (NgArray<double> & data) const;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
// Gundolf Haase 8/26/97
|
|
251
|
+
/// A circle
|
|
252
|
+
template < int D >
|
|
253
|
+
class CircleSeg : public SplineSeg<D>
|
|
254
|
+
{
|
|
255
|
+
///
|
|
256
|
+
private:
|
|
257
|
+
GeomPoint<D> p1, p2, p3;
|
|
258
|
+
//const GeomPoint<D> &p1, &p2, &p3;
|
|
259
|
+
Point<D> pm;
|
|
260
|
+
double radius, w1,w3;
|
|
261
|
+
public:
|
|
262
|
+
///
|
|
263
|
+
CircleSeg (const GeomPoint<D> & ap1,
|
|
264
|
+
const GeomPoint<D> & ap2,
|
|
265
|
+
const GeomPoint<D> & ap3);
|
|
266
|
+
// default constructor for archive
|
|
267
|
+
CircleSeg() {}
|
|
268
|
+
virtual void DoArchive(Archive& ar)
|
|
269
|
+
{
|
|
270
|
+
ar & p1 & p2 & p3 & pm & radius & w1 & w3;
|
|
271
|
+
}
|
|
272
|
+
///
|
|
273
|
+
virtual Point<D> GetPoint (double t) const;
|
|
274
|
+
///
|
|
275
|
+
virtual const GeomPoint<D> & StartPI () const { return p1; }
|
|
276
|
+
///
|
|
277
|
+
virtual const GeomPoint<D> & EndPI () const { return p3; }
|
|
278
|
+
///
|
|
279
|
+
virtual void GetCoeff (Vector & coeffs) const;
|
|
280
|
+
///
|
|
281
|
+
double Radius() const { return radius; }
|
|
282
|
+
///
|
|
283
|
+
double StartAngle() const { return w1; }
|
|
284
|
+
///
|
|
285
|
+
double EndAngle() const { return w3; }
|
|
286
|
+
///
|
|
287
|
+
const Point<D> & MidPoint(void) const {return pm; }
|
|
288
|
+
|
|
289
|
+
virtual string GetType(void) const {return "circle";}
|
|
290
|
+
|
|
291
|
+
virtual void LineIntersections (const double a, const double b, const double c,
|
|
292
|
+
NgArray < Point<D> > & points, const double eps) const;
|
|
293
|
+
|
|
294
|
+
virtual bool InConvexHull (Point<D> p, double eps) const
|
|
295
|
+
{
|
|
296
|
+
return (Dist2 (p, pm) < sqr(radius+eps));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
virtual double MaxCurvature(void) const {return 1./radius;}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
///
|
|
308
|
+
template<int D>
|
|
309
|
+
class DiscretePointsSeg : public SplineSeg<D>
|
|
310
|
+
{
|
|
311
|
+
NgArray<Point<D> > pts;
|
|
312
|
+
GeomPoint<D> p1n, p2n;
|
|
313
|
+
public:
|
|
314
|
+
///
|
|
315
|
+
DiscretePointsSeg (const NgArray<Point<D> > & apts);
|
|
316
|
+
// default constructor for archive
|
|
317
|
+
DiscretePointsSeg() {}
|
|
318
|
+
virtual void DoArchive(Archive& ar)
|
|
319
|
+
{
|
|
320
|
+
ar & pts & p1n & p2n;
|
|
321
|
+
}
|
|
322
|
+
///
|
|
323
|
+
virtual ~DiscretePointsSeg ();
|
|
324
|
+
///
|
|
325
|
+
virtual Point<D> GetPoint (double t) const;
|
|
326
|
+
///
|
|
327
|
+
virtual const GeomPoint<D> & StartPI () const { return p1n; };
|
|
328
|
+
///
|
|
329
|
+
virtual const GeomPoint<D> & EndPI () const { return p2n; }
|
|
330
|
+
///
|
|
331
|
+
virtual void GetCoeff (Vector & coeffs) const {;}
|
|
332
|
+
|
|
333
|
+
virtual double MaxCurvature(void) const {return 1;}
|
|
334
|
+
|
|
335
|
+
// needs implementation ...
|
|
336
|
+
virtual bool InConvexHull (Point<D> p, double eps) const
|
|
337
|
+
{ return true; }
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
// calculates length of spline-curve
|
|
346
|
+
template<int D>
|
|
347
|
+
double SplineSeg<D> :: Length () const
|
|
348
|
+
{
|
|
349
|
+
int n = 100;
|
|
350
|
+
double dt = 1.0 / n;
|
|
351
|
+
|
|
352
|
+
Point<D> pold = GetPoint (0);
|
|
353
|
+
|
|
354
|
+
double l = 0;
|
|
355
|
+
for (int i = 1; i <= n; i++)
|
|
356
|
+
{
|
|
357
|
+
Point<D> p = GetPoint (i * dt);
|
|
358
|
+
l += Dist (p, pold);
|
|
359
|
+
pold = p;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return l;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
template<int D>
|
|
367
|
+
void SplineSeg<D> :: GetPoints (int n, NgArray<Point<D> > & points) const
|
|
368
|
+
{
|
|
369
|
+
points.SetSize (n);
|
|
370
|
+
if (n >= 2)
|
|
371
|
+
for (int i = 0; i < n; i++)
|
|
372
|
+
points[i] = GetPoint(double(i) / (n-1));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
template<int D>
|
|
377
|
+
void SplineSeg<D> :: PrintCoeff (ostream & ost) const
|
|
378
|
+
{
|
|
379
|
+
Vector u(6);
|
|
380
|
+
|
|
381
|
+
GetCoeff(u);
|
|
382
|
+
|
|
383
|
+
for ( int i=0; i<6; i++)
|
|
384
|
+
ost << u[i] << " ";
|
|
385
|
+
ost << endl;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
/*
|
|
391
|
+
Implementation of line-segment from p1 to p2
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
template<int D>
|
|
396
|
+
LineSeg<D> :: LineSeg (const GeomPoint<D> & ap1,
|
|
397
|
+
const GeomPoint<D> & ap2,
|
|
398
|
+
double maxh, string bcname)
|
|
399
|
+
: SplineSeg<D>(maxh, bcname), p1(ap1), p2(ap2)
|
|
400
|
+
{
|
|
401
|
+
;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
template<int D>
|
|
406
|
+
inline Point<D> LineSeg<D> :: GetPoint (double t) const
|
|
407
|
+
{
|
|
408
|
+
return p1 + t * (p2 - p1);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
template<int D>
|
|
412
|
+
Vec<D> LineSeg<D> :: GetTangent (const double t) const
|
|
413
|
+
{
|
|
414
|
+
return p2-p1;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
template<int D>
|
|
418
|
+
void LineSeg<D> :: GetDerivatives (const double t,
|
|
419
|
+
Point<D> & point,
|
|
420
|
+
Vec<D> & first,
|
|
421
|
+
Vec<D> & second) const
|
|
422
|
+
{
|
|
423
|
+
first = p2 - p1;
|
|
424
|
+
point = p1 + t * first;
|
|
425
|
+
second = 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
template<int D>
|
|
430
|
+
double LineSeg<D> :: Length () const
|
|
431
|
+
{
|
|
432
|
+
return Dist (p1, p2);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
template<int D>
|
|
437
|
+
void LineSeg<D> :: GetCoeff (Vector & coeffs) const
|
|
438
|
+
{
|
|
439
|
+
coeffs.SetSize(6);
|
|
440
|
+
|
|
441
|
+
double dx = p2(0) - p1(0);
|
|
442
|
+
double dy = p2(1) - p1(1);
|
|
443
|
+
|
|
444
|
+
coeffs[0] = coeffs[1] = coeffs[2] = 0;
|
|
445
|
+
coeffs[3] = -dy;
|
|
446
|
+
coeffs[4] = dx;
|
|
447
|
+
coeffs[5] = -dx * p1(1) + dy * p1(0);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
template<int D>
|
|
451
|
+
void LineSeg<D> :: GetCoeff (Vector & coeffs, Point<D> p) const
|
|
452
|
+
{
|
|
453
|
+
coeffs.SetSize(6);
|
|
454
|
+
|
|
455
|
+
double dx = p2(0) - p1(0);
|
|
456
|
+
double dy = p2(1) - p1(1);
|
|
457
|
+
|
|
458
|
+
coeffs[0] = coeffs[1] = coeffs[2] = 0;
|
|
459
|
+
coeffs[3] = -dy;
|
|
460
|
+
coeffs[4] = dx;
|
|
461
|
+
coeffs[5] = -dx * (p1(1)-p(1)) + dy * (p1(0)-p(0));
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
template<int D>
|
|
466
|
+
void LineSeg<D> :: LineIntersections (const double a, const double b, const double c,
|
|
467
|
+
NgArray < Point<D> > & points, const double eps) const
|
|
468
|
+
{
|
|
469
|
+
points.SetSize(0);
|
|
470
|
+
|
|
471
|
+
double denom = -a*p2(0)+a*p1(0)-b*p2(1)+b*p1(1);
|
|
472
|
+
if(fabs(denom) < 1e-20)
|
|
473
|
+
return;
|
|
474
|
+
|
|
475
|
+
double t = (a*p1(0)+b*p1(1)+c)/denom;
|
|
476
|
+
if((t > -eps) && (t < 1.+eps))
|
|
477
|
+
points.Append(GetPoint(t));
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
template<int D>
|
|
483
|
+
void LineSeg<D> :: Project (const Point<D> point, Point<D> & point_on_curve, double & t) const
|
|
484
|
+
{
|
|
485
|
+
Vec<D> v = p2-p1;
|
|
486
|
+
double l = v.Length();
|
|
487
|
+
v *= 1./l;
|
|
488
|
+
t = (point-p1)*v;
|
|
489
|
+
|
|
490
|
+
if(t<0) t = 0;
|
|
491
|
+
if(t>l) t = l;
|
|
492
|
+
|
|
493
|
+
point_on_curve = p1+t*v;
|
|
494
|
+
|
|
495
|
+
t *= 1./l;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
template<int D>
|
|
500
|
+
void LineSeg<D> :: GetRawData (NgArray<double> & data) const
|
|
501
|
+
{
|
|
502
|
+
data.Append(2);
|
|
503
|
+
for(int i=0; i<D; i++)
|
|
504
|
+
data.Append(p1[i]);
|
|
505
|
+
for(int i=0; i<D; i++)
|
|
506
|
+
data.Append(p2[i]);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
/*
|
|
514
|
+
template<int D>
|
|
515
|
+
double SplineSeg3<D> :: MaxCurvature(void) const
|
|
516
|
+
{
|
|
517
|
+
Vec<D> v1 = p1-p2;
|
|
518
|
+
Vec<D> v2 = p3-p2;
|
|
519
|
+
double l1 = v1.Length();
|
|
520
|
+
double l2 = v2.Length();
|
|
521
|
+
(*testout) << "v1 " << v1 << " v2 " << v2 << endl;
|
|
522
|
+
|
|
523
|
+
double cosalpha = v1*v2/(l1*l2);
|
|
524
|
+
|
|
525
|
+
(*testout) << "cosalpha " << cosalpha << endl;
|
|
526
|
+
|
|
527
|
+
return sqrt(cosalpha + 1.)/(min2(l1,l2)*(1.-cosalpha));
|
|
528
|
+
}
|
|
529
|
+
*/
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
//########################################################################
|
|
534
|
+
// circlesegment
|
|
535
|
+
|
|
536
|
+
template<int D>
|
|
537
|
+
CircleSeg<D> :: CircleSeg (const GeomPoint<D> & ap1,
|
|
538
|
+
const GeomPoint<D> & ap2,
|
|
539
|
+
const GeomPoint<D> & ap3)
|
|
540
|
+
: p1(ap1), p2(ap2), p3(ap3)
|
|
541
|
+
{
|
|
542
|
+
Vec<D> v1,v2;
|
|
543
|
+
|
|
544
|
+
v1 = p1 - p2;
|
|
545
|
+
v2 = p3 - p2;
|
|
546
|
+
|
|
547
|
+
Point<D> p1t(p1+v1);
|
|
548
|
+
Point<D> p2t(p3+v2);
|
|
549
|
+
|
|
550
|
+
// works only in 2D!!!!!!!!!
|
|
551
|
+
|
|
552
|
+
Line2d g1t,g2t;
|
|
553
|
+
|
|
554
|
+
g1t.P1() = Point<2>(p1(0),p1(1));
|
|
555
|
+
g1t.P2() = Point<2>(p1t(0),p1t(1));
|
|
556
|
+
g2t.P1() = Point<2>(p3(0),p3(1));
|
|
557
|
+
g2t.P2() = Point<2>(p2t(0),p2t(1));
|
|
558
|
+
|
|
559
|
+
Point<2> mp = CrossPoint (g1t,g2t);
|
|
560
|
+
|
|
561
|
+
pm(0) = mp(0); pm(1) = mp(1);
|
|
562
|
+
radius = Dist(pm,StartPI());
|
|
563
|
+
Vec2d auxv;
|
|
564
|
+
auxv.X() = p1(0)-pm(0); auxv.Y() = p1(1)-pm(1);
|
|
565
|
+
w1 = Angle(auxv);
|
|
566
|
+
auxv.X() = p3(0)-pm(0); auxv.Y() = p3(1)-pm(1);
|
|
567
|
+
w3 = Angle(auxv);
|
|
568
|
+
if ( fabs(w3-w1) > M_PI )
|
|
569
|
+
{
|
|
570
|
+
if ( w3>M_PI ) w3 -= 2*M_PI;
|
|
571
|
+
if ( w1>M_PI ) w1 -= 2*M_PI;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
template<int D>
|
|
577
|
+
Point<D> CircleSeg<D> :: GetPoint (double t) const
|
|
578
|
+
{
|
|
579
|
+
if (t >= 1.0) { return p3; }
|
|
580
|
+
double phi = StartAngle() + t*(EndAngle()-StartAngle());
|
|
581
|
+
Vec<D> tmp(cos(phi),sin(phi));
|
|
582
|
+
return pm + Radius()*tmp;
|
|
583
|
+
}
|
|
584
|
+
*/
|
|
585
|
+
template<>
|
|
586
|
+
inline Point<3> CircleSeg<3> :: GetPoint (double t) const
|
|
587
|
+
{
|
|
588
|
+
// not really useful, but keep it as it was ...
|
|
589
|
+
if (t >= 1.0) { return p3; }
|
|
590
|
+
double phi = StartAngle() + t*(EndAngle()-StartAngle());
|
|
591
|
+
Vec<3> tmp(cos(phi),sin(phi),0);
|
|
592
|
+
return pm + Radius()*tmp;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
template<>
|
|
596
|
+
inline Point<2> CircleSeg<2> :: GetPoint (double t) const
|
|
597
|
+
{
|
|
598
|
+
if (t >= 1.0) { return p3; }
|
|
599
|
+
|
|
600
|
+
double phi = StartAngle() + t*(EndAngle()-StartAngle());
|
|
601
|
+
Vec<2> tmp(cos(phi),sin(phi));
|
|
602
|
+
|
|
603
|
+
return pm + Radius()*tmp;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
template<int D>
|
|
607
|
+
void CircleSeg<D> :: GetCoeff (Vector & coeff) const
|
|
608
|
+
{
|
|
609
|
+
coeff[0] = coeff[1] = 1.0;
|
|
610
|
+
coeff[2] = 0.0;
|
|
611
|
+
coeff[3] = -2.0 * pm[0];
|
|
612
|
+
coeff[4] = -2.0 * pm[1];
|
|
613
|
+
coeff[5] = sqr(pm[0]) + sqr(pm[1]) - sqr(Radius());
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
template<int D>
|
|
621
|
+
DiscretePointsSeg<D> :: DiscretePointsSeg (const NgArray<Point<D> > & apts)
|
|
622
|
+
: pts (apts)
|
|
623
|
+
{
|
|
624
|
+
for(int i=0; i<D; i++)
|
|
625
|
+
{
|
|
626
|
+
p1n(i) = apts[0](i);
|
|
627
|
+
p2n(i) = apts.Last()(i);
|
|
628
|
+
}
|
|
629
|
+
p1n.refatpoint = 1;
|
|
630
|
+
p2n.refatpoint = 1;
|
|
631
|
+
p1n.hmax = 1e99;
|
|
632
|
+
p2n.hmax = 1e99;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
template<int D>
|
|
637
|
+
DiscretePointsSeg<D> :: ~DiscretePointsSeg ()
|
|
638
|
+
{ ; }
|
|
639
|
+
|
|
640
|
+
template<int D>
|
|
641
|
+
Point<D> DiscretePointsSeg<D> :: GetPoint (double t) const
|
|
642
|
+
{
|
|
643
|
+
double t1 = t * (pts.Size()-1);
|
|
644
|
+
int segnr = int(t1);
|
|
645
|
+
if (segnr < 0) segnr = 0;
|
|
646
|
+
if (segnr >= pts.Size()) segnr = pts.Size()-1;
|
|
647
|
+
|
|
648
|
+
double rest = t1 - segnr;
|
|
649
|
+
|
|
650
|
+
return pts[segnr] + rest*Vec<D>(pts[segnr+1]-pts[segnr]);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
// *************************************
|
|
662
|
+
// Template for B-Splines of order ORDER
|
|
663
|
+
// thx to Gerhard Kitzler
|
|
664
|
+
// *************************************
|
|
665
|
+
|
|
666
|
+
template<int D, int ORDER>
|
|
667
|
+
class BSplineSeg : public SplineSeg<D>
|
|
668
|
+
{
|
|
669
|
+
NgArray<Point<D> > pts;
|
|
670
|
+
GeomPoint<D> p1n, p2n;
|
|
671
|
+
NgArray<int> ti;
|
|
672
|
+
|
|
673
|
+
public:
|
|
674
|
+
///
|
|
675
|
+
BSplineSeg (const NgArray<Point<D> > & apts);
|
|
676
|
+
///
|
|
677
|
+
//default constructor for archive
|
|
678
|
+
BSplineSeg() {}
|
|
679
|
+
virtual ~BSplineSeg();
|
|
680
|
+
///
|
|
681
|
+
virtual void DoArchive(Archive& ar)
|
|
682
|
+
{
|
|
683
|
+
ar & pts & p1n & p2n & ti;
|
|
684
|
+
}
|
|
685
|
+
virtual Point<D> GetPoint (double t) const;
|
|
686
|
+
///
|
|
687
|
+
virtual const GeomPoint<D> & StartPI () const { return p1n; };
|
|
688
|
+
///
|
|
689
|
+
virtual const GeomPoint<D> & EndPI () const { return p2n; }
|
|
690
|
+
///
|
|
691
|
+
virtual void GetCoeff (Vector & coeffs) const {;}
|
|
692
|
+
|
|
693
|
+
virtual double MaxCurvature(void) const {return 1;}
|
|
694
|
+
|
|
695
|
+
// needs implementation ...
|
|
696
|
+
virtual bool InConvexHull (Point<D> p, double eps) const
|
|
697
|
+
{ return true; }
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
// Constructor
|
|
701
|
+
template<int D,int ORDER>
|
|
702
|
+
BSplineSeg<D,ORDER> :: BSplineSeg (const NgArray<Point<D> > & apts)
|
|
703
|
+
: pts (apts)
|
|
704
|
+
{
|
|
705
|
+
/*
|
|
706
|
+
for(int i=0; i<D; i++)
|
|
707
|
+
{
|
|
708
|
+
p1n(i) = apts[0](i);
|
|
709
|
+
p2n(i) = apts.Last()(i);
|
|
710
|
+
}
|
|
711
|
+
*/
|
|
712
|
+
p1n = apts[0];
|
|
713
|
+
p2n = apts.Last();
|
|
714
|
+
|
|
715
|
+
/*
|
|
716
|
+
p1n.refatpoint = 1;
|
|
717
|
+
p2n.refatpoint = 1;
|
|
718
|
+
p1n.hmax = 1e99;
|
|
719
|
+
p2n.hmax = 1e99;
|
|
720
|
+
*/
|
|
721
|
+
|
|
722
|
+
int m=pts.Size()+ORDER;
|
|
723
|
+
ti.SetSize(m);
|
|
724
|
+
// b.SetSize(m-1);
|
|
725
|
+
ti=0;
|
|
726
|
+
// b=0.0;
|
|
727
|
+
for(int i=ORDER;i<m-ORDER+1;i++)
|
|
728
|
+
ti[i]=i-ORDER+1;
|
|
729
|
+
for(int i=m-ORDER+1;i<m;i++)
|
|
730
|
+
ti[i]=m-2*ORDER+1;
|
|
731
|
+
}
|
|
732
|
+
// Destructor
|
|
733
|
+
template<int D,int ORDER>
|
|
734
|
+
BSplineSeg<D, ORDER> :: ~BSplineSeg ()
|
|
735
|
+
{ ; }
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
// GetPoint Method...(evaluation of BSpline Curve)
|
|
739
|
+
template<int D,int ORDER>
|
|
740
|
+
Point<D> BSplineSeg<D,ORDER> :: GetPoint (double t_in) const
|
|
741
|
+
{
|
|
742
|
+
int m=pts.Size()+ORDER;
|
|
743
|
+
|
|
744
|
+
double t = t_in * (m-2*ORDER+1);
|
|
745
|
+
|
|
746
|
+
double b[ORDER];
|
|
747
|
+
|
|
748
|
+
int interval_nr = int(t)+ORDER-1;
|
|
749
|
+
if (interval_nr < ORDER-1) interval_nr = ORDER-1;
|
|
750
|
+
if (interval_nr > m-ORDER-1) interval_nr = m-ORDER-1;
|
|
751
|
+
|
|
752
|
+
b[ORDER-1] = 1.0;
|
|
753
|
+
|
|
754
|
+
for(int degree=1;degree<ORDER;degree++)
|
|
755
|
+
for (int k = 0; k <= degree; k++)
|
|
756
|
+
{
|
|
757
|
+
int j = interval_nr-degree+k;
|
|
758
|
+
double bnew = 0;
|
|
759
|
+
|
|
760
|
+
if (k != 0)
|
|
761
|
+
bnew += (t-ti[j]) / ( ti[j+degree]-ti[j] ) * b[k-degree+ORDER-1];
|
|
762
|
+
if (k != degree)
|
|
763
|
+
bnew += (ti[j+degree+1]-t) / ( ti[j+degree+1]-ti[j+1] ) * b[k-degree+ORDER];
|
|
764
|
+
b[k-degree+ORDER-1] = bnew;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
Point<D> p = 0.0;
|
|
768
|
+
for(int i=0; i < ORDER; i++)
|
|
769
|
+
p += b[i] * Vec<D> (pts[i+interval_nr-ORDER+1]);
|
|
770
|
+
return p;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
#endif
|