Commit 6830b126 authored by Max Lyon's avatar Max Lyon

inital commit

parents
Pipeline #1941 skipped
libHexEx uses the cmake build system.
libHexEx depends on OpenVolumeMesh 2.0, which is available on www.openvolumemesh.org.
In order to build libHexEx, you can perform the following steps:
# Clone libHexEx
git clone https://www.graphics.rwth-aachen.de:9000/HexEx/libHexEx.git libHexEx
cd libHexEx
# Create build directory
mkdir build
cd build
# Initialize the build directory
cmake -D OPENVOLUMEMESH_INCLUDE_DIR=/path/to/OpenVolumeMesh/src \
-D OPENVOLUMEMESH_LIBRARY_DIR=/path/to/OpenVolumeMesh/binaries ..
# Build
make
# Try a demo
./demo/minimum_example/minimum_example
#
# Copyright 2013 Computer Graphics Group, RWTH Aachen University
# Authors: Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de>
#
# This file is part of HexEx.
#
# HexEx is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with HexEx. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required (VERSION 2.6)
# Only set project name if not build from within another project.
if("${PROJECT_NAME}" STREQUAL "")
project (HexEx)
endif()
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
find_package (OpenVolumeMesh REQUIRED)
add_definitions(-DINCLUDE_TEMPLATES)
set (SOURCES "")
set (INCLUDE_DIRS "")
set (LIBRARIES "")
set (LIBRARY_DIRS "")
file(GLOB SRCS "${CMAKE_CURRENT_LIST_DIR}/src/*.cc" "${CMAKE_CURRENT_LIST_DIR}/src/*.c")
list (APPEND SOURCES ${SRCS})
list (APPEND INCLUDE_DIRS ${OPENVOLUMEMESH_INCLUDE_DIR})
list (APPEND LIBRARY_DIRS ${OPENVOLUMEMESH_LIBRARY_DIR})
list (APPEND LIBRARIES ${OPENVOLUMEMESH_LIBRARY})
include_directories (${INCLUDE_DIRS})
link_directories (${CMAKE_BINARY_DIR} ${LIBRARY_DIRS} )
add_library (HexEx SHARED ${SOURCES})
add_library (HexExStatic STATIC ${SOURCES})
target_link_libraries (HexEx ${LIBRARIES})
target_link_libraries (HexExStatic ${LIBRARIES})
#
# In order for the exact predicates to work the compiler
# must not generate x87 FPU code as this leads to the use
# of extended precision registers which lead to
# wrong results.
#
# As SSE does not have extended precision registers,
# forcing the generation of SSE code ensures that the
# exact predicates produce correct results.
#
set (HEXEX_COMPILE_FLAGS "-Wall")
set (HEXEX_CXX_COMPILE_FLAGS "")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (HEXEX_COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS} -msse -mfpmath=sse -pedantic -Weverything" )
set (HEXEX_CXX_COMPILE_FLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set (HEXEX_COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS} -msse -mfpmath=sse -pedantic -Wextra")
set (HEXEX_CXX_COMPILE_FLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
message (WARNING
"You are using an Intel compiler which might generate x87 FPU code "
"that breaks the exact predicates. If you know which compiler flags "
"ensure that the Intel compiler produces SSE code, please patch "
"the CMakeLists.txt and inform the author <lyon@cs.rwth-aachen.de>.")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# There is code in exactinit() that should make sure that nor
# x87 extended internal precision is used.
else ()
message (WARNING
"You are using an unknown compiler which might generate x87 FPU code "
"that breaks the exact predicates. If you know how to detect this compiler "
"and which flags "
"ensure that this compiler produces SSE code, please patch "
"the CMakeLists.txt and inform the author <lyon@cs.rwth-aachen.de>.")
endif ()
set(STL_RANGE_CHECKS false CACHE BOOL "Include STL range checks in debug mode (This option is only used in debug mode.)")
# Add a flag to check stl vectors in debugging mode
if (STL_RANGE_CHECKS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" )
endif()
set_target_properties (HexEx
PROPERTIES
COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS}"
DEFINE_SYMBOLS "-DHEXEX_EXPORT_SYMBOLS"
)
set_target_properties (HexExStatic
PROPERTIES
COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS}"
DEFINE_SYMBOLS "-DHEXEX_EXPORT_SYMBOLS"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HEXEX_CXX_COMPILE_FLAGS}")
#
# Fake successful finder run if compiling as a dependent project.
#
if(NOT "${PROJECT_NAME}" MATCHES "HexEx")
set (HEXEX_FOUND true PARENT_SCOPE)
set (HEXEX_LIBRARIES HexEx PARENT_SCOPE)
set (HEXEX_LIBRARY HexEx PARENT_SCOPE)
set (HEXEX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/" PARENT_SCOPE)
set (HEXEX_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory where the HexEx libraries can be found.")
endif()
if("${PROJECT_NAME}" MATCHES "HexEx")
add_subdirectory(demo/cmdline_tool)
add_subdirectory(demo/minimum_example)
endif()
#set(BUILD_UNIT_TESTS false CACHE BOOL "Whether to build the unit tests.")
#if (BUILD_UNIT_TESTS)
# enable_testing()
# set(GTEST_DIR CACHE PATH "Source path of googletest.")
# if (NOT GTEST_DIR)
# message(FATAL_ERROR "GTEST_DIR unset")
# endif()
# add_subdirectory(${GTEST_DIR} gtest)
# add_subdirectory(tests)
#endif()
#find_package(Doxygen)
#if (DOXYGEN_FOUND)
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
# add_custom_target(qex_doc
# ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
# COMMENT "Generating Doxygen documentation" VERBATIM)
#endif()
This diff is collapsed.
This diff is collapsed.
libHexEx – A Robust Hexahedral Mesh Extractor
======
`libHexEx` is an implementation of [HexEx](https://www.graphics.rwth-aachen.de/publication/03260/) \[[Lyon et al. 2016](http://dx.doi.org/10.1145/2897824.2925976)\] distributed under GPLv3.
If you make use of `libHexEx` in your scientific work, please cite our paper. For your convenience,
you can use the following bibtex snippet:
@article{Lyon:2016:HRH:2897824.2925976,
author = {Lyon, Max and Bommes, David and Kobbelt, Leif},
title = {{H}ex{E}x: Robust Hexahedral Mesh Extraction},
journal = {ACM Trans. Graph.},
year = {2016},
numpages = {11},
url = {http://dx.doi.org/10.1145/2897824.2925976},
doi = {10.1145/2897824.2925976},
acmid = {2925976},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {hex meshing, parametrization, mesh extraction},
}
## What is HexEx?
HexEx is a method for robust hex mesh extraction from 3D Integer-Grid Maps with imperfections.
(Imperfect) 3D Integer-Grid Maps are what is generated by most state-of-the-art hex meshing
methods such as CubeCover \[[Nieser et al. 2011](http://dx.doi.org/10.1111/j.1467-8659.2011.02014.x)\].
Hex extraction is a complicated task because numerous special cases, ambiguities induced
by numerical inaccuracies and limited solver precision, as well as imperfections in the
maps pose significant challenges to the hex mesh extractor.
Read [our paper](https://www.graphics.rwth-aachen.de/publication/03260/) if you want
to find out why hex extraction is complicated and how we tackle it or skip ahead and
download the source code if you don't care about the details and just need results.
## License
`libHexEx` is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version. See [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
If you make use of `libHexEx` in scientific work we kindly ask you to cite our
paper. (You can use the bibtex snippet above.)
## Bibliography
[Lyon, M., Bommes, D. and Kobbelt, L. 2016. HexEx: Robust Hexahedral Mesh Extraction. ACM Trans. Graph.](http://dx.doi.org/10.1145/2897824.2925976)
[Nieser, M., Reitebuch, U. and Polthier, K. 2011. CubeCover - Parameterization of 3D Volumes. The Eurographics Association and Blackwell Publishing Ltd.](http://dx.doi.org/10.1111/j.1467-8659.2011.02014.x)
#
# Try to find OPENVOLUMEMESH
# Once done this will define
#
# OPENVOLUMEMESH_FOUND - system has OPENVOLUMEMESH
# OPENVOLUMEMESH_INCLUDE_DIR - the OPENVOLUMEMESH include directory
# OPENVOLUMEMESH_LIBRARY - Link these to use OPENVOLUMEMESH
# OPENVOLUMEMESH_LIBRARY_DIR - Library DIR of OPENVOLUMEMESH
#
# Copyright 2013 Computer Graphics Group, RWTH Aachen University
# Authors: Jan Möbius <moebius@cs.rwth-aachen.de>
# Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de>
#
# This file is part of HexEx.
#
# HexEx is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with HexEx. If not, see <http://www.gnu.org/licenses/>.
#
IF (OPENVOLUMEMESH_INCLUDE_DIR)
# Already in cache, be silent
SET(OPENVOLUMEMESH_FIND_QUIETLY TRUE)
ENDIF (OPENVOLUMEMESH_INCLUDE_DIR)
FIND_PATH(OPENVOLUMEMESH_INCLUDE_DIR OpenVolumeMesh/Mesh/TetrahedralMesh.hh
PATHS /usr/local/include
/usr/include
/usr/local/OpenVolumeMesh/include
"${CMAKE_SOURCE_DIR}/OpenVolumeMesh/src"
"${CMAKE_SOURCE_DIR}/libs_required/OpenVolumeMesh/src"
"${CMAKE_SOURCE_DIR}/../OpenVolumeMesh/src"
/ACG/acgdev/gcc-4.0-x86_64/OVM/OpenVolumeMesh/installed/include
"C:\\Program Files\\OpenVolumeMesh\\include"
)
IF (OPENVOLUMEMESH_INCLUDE_DIR )
SET(OPENVOLUMEMESH_FOUND TRUE)
ADD_DEFINITIONS(-DENABLE_OPENVOLUMEMESH)
IF (WIN32)
IF(EXISTS "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib")
SET(OPENVOLUMEMESH_LIBRARY_DIR "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib")
ENDIF()
ELSE (WIN32)
IF(EXISTS "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib/OpenVolumeMesh")
SET(OPENVOLUMEMESH_LIBRARY_DIR "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib/OpenVolumeMesh")
ENDIF()
ENDIF (WIN32)
SET(OPENVOLUMEMESH_LIBRARY "OpenVolumeMesh")
ELSE (OPENVOLUMEMESH_INCLUDE_DIR)
SET(OPENVOLUMEMESH_FOUND FALSE )
ENDIF (OPENVOLUMEMESH_INCLUDE_DIR )
#
# Copyright 2016 Computer Graphics Group, RWTH Aachen University
# Author: Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de
#
# This file is part of HexEx.
#
# HexEx is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with HexEx. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.4)
find_package (OpenVolumeMesh REQUIRED)
# disable OpenVolumeMesh debug output
add_definitions(-DNDEBUG)
set (CMDLINE_TOOL_SOURCES "")
set (CMDLINE_TOOL_INCLUDE_DIRS "")
set (CMDLINE_TOOL_LIBRARIES "")
set (CMDLINE_TOOL_LIBRARY_DIRS "")
list (APPEND CMDLINE_TOOL_SOURCES main.cc)
list (APPEND CMDLINE_TOOL_INCLUDE_DIRS
${OPENVOLUMEMESH_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../src
${HEXEX_INCLUDE_DIRS}
)
list (APPEND CMDLINE_TOOL_LIBRARIES
${OPENVOLUMEMESH_LIBRARY}
HexExStatic
)
list (APPEND CMDLINE_TOOL_LIBRARY_DIRS ${OPENVOLUMEMESH_LIBRARY_DIR})
add_executable (cmdline_tool ${CMDLINE_TOOL_SOURCES})
LINK_DIRECTORIES(cmdline_tool ${CMDLINE_TOOL_LIBRARY_DIRS} )
target_link_libraries(cmdline_tool ${CMDLINE_TOOL_LIBRARIES})
if (NOT WIN32 )
set(HEXEX_COMPILE_FLAGS "-Wall -Wextra -pedantic -std=c++11 -Wno-long-long")
else()
set(HEXEX_COMPILE_FLAGS "")
endif()
set_target_properties(cmdline_tool
PROPERTIES
INCLUDE_DIRECTORIES "${CMDLINE_TOOL_INCLUDE_DIRS}"
COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS}"
)
#include <iostream>
#include <fstream>
#include <HexEx.hh>
bool isInFileGood(const std::string& filename)
{
std::ifstream is(filename.c_str());
return is.good();
}
bool isOutFileGood(const std::string& filename)
{
std::ofstream os(filename.c_str());
return os.good();
}
void printUsage(const std::string& progname)
{
std::cout << "usage: " << progname << " <inFile> <outFile>" << std::endl
<< std::endl
<< "Reads input tet mesh with parametrization from <inFile> " << std::endl
<< "and writes the resulting hex mesh to <outFile> in ovm format." << std::endl;
}
int main(int argc, const char* argv[])
{
if (argc != 3)
{
printUsage(argv[0]);
return 0;
}
auto inFilename = std::string(argv[1]);
auto outFilename = std::string(argv[2]);
if (!isInFileGood(inFilename))
{
std::cout << "Could not open input File " << inFilename << std::endl;
return 1;
}
if (!isOutFileGood(outFilename))
{
std::cout << "Could not open output File " << outFilename << std::endl;
return 1;
}
if (isInFileGood(inFilename) && isOutFileGood(outFilename))
HexEx::extractHexMesh(inFilename, outFilename);
return 0;
}
#
# Copyright 2016 Computer Graphics Group, RWTH Aachen University
# Author: Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de
#
# This file is part of HexEx.
#
# HexEx is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with HexEx. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.4)
find_package (OpenVolumeMesh REQUIRED)
# disable OpenVolumeMesh debug output
add_definitions(-DNDEBUG)
set (MINIMUM_EXAMPLE_SOURCES "")
set (MINIMUM_EXAMPLE_INCLUDE_DIRS "")
set (MINIMUM_EXAMPLE_LIBRARIES "")
set (MINIMUM_EXAMPLE_LIBRARY_DIRS "")
list (APPEND MINIMUM_EXAMPLE_SOURCES main.cc)
list (APPEND MINIMUM_EXAMPLE_INCLUDE_DIRS
${OPENVOLUMEMESH_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../src
${HEXEX_INCLUDE_DIRS}
)
list (APPEND MINIMUM_EXAMPLE_LIBRARIES
${OPENVOLUMEMESH_LIBRARY}
HexExStatic
)
list (APPEND MINIMUM_EXAMPLE_LIBRARY_DIRS ${OPENVOLUMEMESH_LIBRARY_DIR})
add_executable (minimum_example ${MINIMUM_EXAMPLE_SOURCES})
LINK_DIRECTORIES(minimum_example ${MINIMUM_EXAMPLE_LIBRARY_DIRS} )
target_link_libraries(minimum_example ${MINIMUM_EXAMPLE_LIBRARIES})
if (NOT WIN32 )
set(HEXEX_COMPILE_FLAGS "-Wall -Wextra -pedantic -std=c++11 -Wno-long-long")
else()
set(HEXEX_COMPILE_FLAGS "")
endif()
set_target_properties(minimum_example
PROPERTIES
INCLUDE_DIRECTORIES "${MINIMUM_EXAMPLE_INCLUDE_DIRS}"
COMPILE_FLAGS "${HEXEX_COMPILE_FLAGS}"
)
#include <iostream>
#include <HexEx.hh>
int main()
{
using namespace HexEx;
using namespace OpenVolumeMesh;
// create a tet mesh representing a cube
TetrahedralMesh tetMesh;
// add the eight corners
auto corners = std::vector<OpenVolumeMesh::VertexHandle>();
corners.push_back(tetMesh.add_vertex(Vec3d(0,0,0)));
corners.push_back(tetMesh.add_vertex(Vec3d(0,0,1)));
corners.push_back(tetMesh.add_vertex(Vec3d(1,0,1)));
corners.push_back(tetMesh.add_vertex(Vec3d(1,0,0)));
corners.push_back(tetMesh.add_vertex(Vec3d(0,1,0)));
corners.push_back(tetMesh.add_vertex(Vec3d(0,1,1)));
corners.push_back(tetMesh.add_vertex(Vec3d(1,1,1)));
corners.push_back(tetMesh.add_vertex(Vec3d(1,1,0)));
// add the five tets
tetMesh.add_cell(corners[0], corners[1], corners[2], corners[5]);
tetMesh.add_cell(corners[2], corners[3], corners[0], corners[7]);
tetMesh.add_cell(corners[5], corners[4], corners[7], corners[0]);
tetMesh.add_cell(corners[7], corners[6], corners[5], corners[2]);
tetMesh.add_cell(corners[0], corners[5], corners[2], corners[7]);
// create a property that can store the parameter location for each of the four vertices of each tet
auto parametrization = tetMesh.request_cell_property<std::map<OpenVolumeMesh::VertexHandle, Vec3d> >("Parametrization");
// optionally set parametrization persistent so the property
// stays on tetMesh even after parametrization goes out of scope
tetMesh.set_persistent(parametrization);
// fill parametrization property
// iterate over all cells
for (auto c_it = tetMesh.cells_begin(); c_it != tetMesh.cells_end(); ++c_it)
// iterate over all vertices of that cell
for (auto cv_it = tetMesh.cv_iter(*c_it); cv_it.valid(); ++cv_it)
// set parameter to 2 times its position
parametrization[*c_it][*cv_it] = 2 * tetMesh.vertex(*cv_it);
// create a hex mesh
HexahedralMesh hexMesh;
// extract the hex mesh
extractHexMesh(tetMesh, parametrization, hexMesh);
// print some interesting information
std::cout << "The extracted hex mesh has " << hexMesh.n_cells() << " cells, "
<< hexMesh.n_faces() << " faces, " << hexMesh.n_edges() << " edges, and "
<< hexMesh.n_vertices() << " vertices." << std::endl;
}
/*
* Copyright 2016 Computer Graphics Group, RWTH Aachen University
* Author: Max Lyon <lyon@cs.rwth-aachen.de>
*
* This file is part of HexEx.
*
* HexEx is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with HexEx. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Dart.hh"
#include "HexExtractor.hh"
namespace HexEx
{
Dart::Dart(HexExtractor& hexExtractor, HPortHandle tracePort, Direction refDir, Direction normalDir)
:
he(hexExtractor),
tracePort(tracePort),
refDir(refDir),
normalDir(normalDir),
alphas({nullptr, nullptr, nullptr, nullptr}),
halfedge(HalfEdgeHandle()),
halfface(HalfFaceHandle()),
uv(Parameter(0,0,0))
{
static int global_id = 0;
id = global_id++;
assert(hexExtractor.isDartInCell(tracePort.cell(), tracePort, refDir,normalDir));
}
CellHandle Dart::getHexCell()
{
if (!halfface.is_valid())
return CellHandle();
return he.intermediateHexMesh.incident_cell(halfface);
}
bool Dart::operator==(const Dart& other)
{
return tracePort == other.tracePort &&
refDir == other.refDir &&
normalDir == other.normalDir;
}
template <>
Transition Dart::getTransitionToAlpha<0>()
{
auto d1 = getTraceDir();
auto d2 = getRefDir();
auto d3 = getNormalDir();
auto p1 = getParameter();
auto other = getAlpha<0>();
auto d4 = other->getTraceDir().flipped();
auto d5 = other->getRefDir();
auto d6 = other->getNormalDir();
auto p2 = other->getParameter() - d4;
if (isAnti() != other->isAnti())
{
d4 = other->getTraceDir();
p2 = other->getParameter();
}