mirror of https://github.com/CGAL/cgal
.C->.cpp
This commit is contained in:
parent
fdf9a1ccae
commit
551e2ee831
|
|
@ -581,8 +581,7 @@ void simplify_and_output(const Nef_polyhedron_3& DIFF,
|
|||
Nef_polyhedron_3 rediff = nu2.get_union();
|
||||
Nef_polyhedron_3 recv2 = NCV - rediff;
|
||||
PVC pvct2(recv2);
|
||||
std::cerr << "volume of approximation "
|
||||
<< pvct2.get_volume_of_polyhedron() << std::endl;
|
||||
float approx = pvct2.get_volume_of_polyhedron();
|
||||
CGAL_assertion((recv2-NCV).is_empty());
|
||||
// CGAL_assertion((DIFF-rediff).is_empty());
|
||||
|
||||
|
|
@ -601,9 +600,13 @@ void simplify_and_output(const Nef_polyhedron_3& DIFF,
|
|||
CSP.visit_shell_objects(csp_volume->shells_begin(), pv);
|
||||
*/
|
||||
|
||||
int facet_counter = 0;
|
||||
int obstacle_counter = 0;
|
||||
CGAL_forall_volumes(ci, DIFF) {
|
||||
if(find(ci, c2c) != ci) continue;
|
||||
++obstacle_counter;
|
||||
Nef_polyhedron_3 ncv = c2N[ci];
|
||||
facet_counter += ncv.number_of_facets();
|
||||
|
||||
Nef_polyhedron_3 tmp = CSP.intersection(ncv);
|
||||
std::list<Plane_3> goodPlanesL;
|
||||
|
|
@ -630,6 +633,10 @@ void simplify_and_output(const Nef_polyhedron_3& DIFF,
|
|||
vout.dump();
|
||||
}
|
||||
|
||||
std::cout << "approximation: " << approx << std::endl;
|
||||
std::cout << "facets: " << facet_counter << std::endl;
|
||||
std::cout << "obstacles: " << obstacle_counter << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
#include<CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Nef_polyhedron_3.h>
|
||||
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
|
||||
#include <CGAL/IO/Qt_widget_Nef_3.h>
|
||||
#include <qapplication.h>
|
||||
#include <CGAL/Nef_3/convex_decomposition_3.h>
|
||||
#include <CGAL/Nef_3/is_reflex_sedge.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/convexity_check_3.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
|
@ -46,6 +49,25 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
convex_decomposition_3<Nef_polyhedron_3>(N);
|
||||
|
||||
N.is_valid(0,0);
|
||||
|
||||
Nef_polyhedron_3::SHalfedge_const_iterator cse;
|
||||
CGAL_forall_shalfedges(cse, N)
|
||||
if(cse->incident_sface()->mark())
|
||||
CGAL_assertion(!CGAL::is_reflex_sedge_in_any_direction<Nef_polyhedron_3>(cse));
|
||||
|
||||
Nef_polyhedron_3::Volume_const_iterator ci;
|
||||
CGAL_forall_volumes(ci, N) {
|
||||
if(!ci->mark()) continue;
|
||||
ci != N.volumes_begin();
|
||||
CGAL_assertion(++ci->shells_begin() == ci->shells_end());
|
||||
// TODO: test whether shell is outer shell
|
||||
Nef_polyhedron_3::SFace_const_handle sf(ci->shells_begin());
|
||||
CGAL::Polyhedron_3<Kernel> P;
|
||||
N.convert_inner_shell_to_polyhedron(sf, P);
|
||||
CGAL::is_strongly_convex_3(P);
|
||||
}
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>* w =
|
||||
new CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>(N);
|
||||
|
|
|
|||
|
|
@ -102,10 +102,13 @@ int main(int argc, char* argv[]) {
|
|||
for(hi = hsp.begin(); hi != hsp.end(); ++hi) {
|
||||
std::cerr << "polyhedron " << ++i << std::endl;
|
||||
if(hi == hsp.begin()) {
|
||||
std::cerr << "create 1 " << std::endl;
|
||||
result = create_from_halfspaces(*hi, false);
|
||||
std::cerr << "test 1 " << std::endl;
|
||||
if(!test_convex_hull(result, *hi, false))
|
||||
std::cerr << "convex hull incorrect" << std::endl;
|
||||
} else {
|
||||
std::cerr << "create 2 " << std::endl;
|
||||
Nef_polyhedron_3 tmp = create_from_halfspaces(*hi, false);
|
||||
std::cerr << "size of obstacle " << tmp.number_of_vertices() << std::endl;
|
||||
if(!test_convex_hull(tmp, *hi, false))
|
||||
|
|
|
|||
|
|
@ -13,21 +13,16 @@ include $(CGAL_MAKEFILE)
|
|||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
MY_DIR = /KM/usr/hachenb/SVN/CGAL
|
||||
POLY = $(MY_DIR)/Polynomial/include
|
||||
LOCAL = $(MY_DIR)/local/include
|
||||
MY_DIR = /home/phachenb/CGAL
|
||||
NEFS2 = $(MY_DIR)/Nef_S2/include
|
||||
NEF2 = $(MY_DIR)/Nef_2/include
|
||||
NEF3 = $(MY_DIR)/Filtered_Nef/Nef_3/include
|
||||
NEFS2 = $(MY_DIR)/Filtered_Nef/Nef_S2/include
|
||||
WALKER = $(HOME)/projects/SNC_walker
|
||||
BBOX = $(MY_DIR)/Box_intersection_d/include
|
||||
NEF3 = $(MY_DIR)/Nef_3/include
|
||||
MINKOWSKI = $(MY_DIR)/Nef_3/Minkowski/include
|
||||
|
||||
CUSTOM_CXXFLAGS = -I$(NEF3) -I$(NEFS2) -I$(MINKOWSKI) -I$(BBOX)
|
||||
|
||||
CXXFLAGS = -DCGAL_NEF3_NARY_UNION_VIA_QUEUE \
|
||||
-DNDEBUG \
|
||||
-O2 \
|
||||
CXXFLAGS = -I$(NEF3) -I$(NEFS2) -I$(NEF2) -I$(MINKOWSKI) \
|
||||
-O2 -DNDEBUG \
|
||||
-DCGAL_TCSP_PRINT_CSP \
|
||||
-DCGAL_TCSP_CENTER_SUITCASE \
|
||||
$(CGAL_CXXFLAGS) \
|
||||
$(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
$(DEBUG_OPT) \
|
||||
|
|
@ -59,7 +54,11 @@ all: \
|
|||
generate_convex$(EXE_EXT) \
|
||||
minkowski_sum$(EXE_EXT) \
|
||||
top_bottom_test$(EXE_EXT) \
|
||||
trunk_configuration_space$(EXE_EXT)
|
||||
trunk_configuration_space$(EXE_EXT) \
|
||||
csp2hsp$(EXE_EXT) \
|
||||
hsp2csp$(EXE_EXT) \
|
||||
computeDiff$(EXE_EXT) \
|
||||
transform_csp_according_to_uncentered_box$(EXE_EXT)
|
||||
|
||||
|
||||
convex$(EXE_EXT): convex$(OBJ_EXT)
|
||||
|
|
@ -95,6 +94,18 @@ top_bottom_test$(EXE_EXT): top_bottom_test$(OBJ_EXT)
|
|||
trunk_configuration_space$(EXE_EXT): trunk_configuration_space$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)trunk_configuration_space trunk_configuration_space$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
csp2hsp$(EXE_EXT): csp2hsp$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)csp2hsp csp2hsp$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
hsp2csp$(EXE_EXT): hsp2csp$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)hsp2csp hsp2csp$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
computeDiff$(EXE_EXT): computeDiff$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)computeDiff computeDiff$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
transform_csp_according_to_uncentered_box$(EXE_EXT): transform_csp_according_to_uncentered_box$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)transform_csp_according_to_uncentered_box transform_csp_according_to_uncentered_box$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
clean: \
|
||||
convex.clean \
|
||||
boundary_offset_test.clean \
|
||||
|
|
@ -106,7 +117,11 @@ clean: \
|
|||
generate_convex.clean \
|
||||
minkowski_sum.clean \
|
||||
top_bottom_test.clean \
|
||||
trunk_configuration_space.clean
|
||||
trunk_configuration_space.clean \
|
||||
csp2hsp.clean \
|
||||
hsp2csp.clean \
|
||||
computeDiff.clean \
|
||||
transform_csp_according_to_uncentered_box.clean
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
|
|
@ -115,3 +130,5 @@ clean: \
|
|||
.C$(OBJ_EXT):
|
||||
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<
|
||||
|
||||
.cpp$(OBJ_EXT):
|
||||
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<
|
||||
|
|
|
|||
|
|
@ -21,26 +21,42 @@ void loadHsp() {
|
|||
for(int h=0; h<hulls; ++h) {
|
||||
// std::cerr << "read hull " << h << std::endl;
|
||||
Plane_3 pl;
|
||||
Plane_list plist;
|
||||
|
||||
int planes;
|
||||
std::cin >> planes;
|
||||
for(int p=0; p<planes; ++p) {
|
||||
// std::cerr << "read plane " << p << std::endl;
|
||||
std::cin >> pl;
|
||||
plist.push_back(pl);
|
||||
for(int j=0; j<2; ++j) {
|
||||
Plane_list plist;
|
||||
int planes;
|
||||
std::cin >> planes;
|
||||
for(int p=0; p<planes; ++p) {
|
||||
// std::cerr << "read plane " << p << std::endl;
|
||||
std::cin >> pl;
|
||||
plist.push_back(pl);
|
||||
}
|
||||
hsp.push_back(plist);
|
||||
}
|
||||
hsp.push_back(plist);
|
||||
}
|
||||
}
|
||||
|
||||
bool test_point_in_polyhedron(const Point_3 p,
|
||||
const Plane_list& plane_list,
|
||||
const Plane_list& bad,
|
||||
const Plane_list& good,
|
||||
bool turn) {
|
||||
|
||||
bool result = true;
|
||||
Plane_list_iterator pli;
|
||||
for(pli = plane_list.begin(); pli != plane_list.end(); ++pli) {
|
||||
for(pli = bad.begin(); pli != bad.end(); ++pli) {
|
||||
CGAL::Oriented_side os = pli->oriented_side(p);
|
||||
if(os == CGAL::ON_ORIENTED_BOUNDARY)
|
||||
std::cerr << "attention: point on boundary " << *pli << std::endl;
|
||||
if(turn) {
|
||||
if(os != CGAL::ON_NEGATIVE_SIDE) continue;
|
||||
} else {
|
||||
if(os != CGAL::ON_POSITIVE_SIDE) continue;
|
||||
}
|
||||
std::cerr << "fail " << *pli << std::endl;
|
||||
result = false;
|
||||
}
|
||||
|
||||
for(pli = good.begin(); pli != good.end(); ++pli) {
|
||||
CGAL::Oriented_side os = pli->oriented_side(p);
|
||||
if(turn) {
|
||||
if(os == CGAL::ON_POSITIVE_SIDE) continue;
|
||||
|
|
@ -48,12 +64,10 @@ bool test_point_in_polyhedron(const Point_3 p,
|
|||
if(os == CGAL::ON_NEGATIVE_SIDE) continue;
|
||||
}
|
||||
if(os == CGAL::ON_ORIENTED_BOUNDARY)
|
||||
std::cerr << "on boundary " << *pli << std::endl;
|
||||
else {
|
||||
std::cerr << "fail " << *pli << std::endl;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
std::cerr << "on csp boundary " << std::endl;
|
||||
std::cerr << "fail " << *pli << std::endl;
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -76,18 +90,26 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
loadHsp();
|
||||
|
||||
CGAL_assertion((hsp.size()%2) == 0);
|
||||
Plane_list emptyList;
|
||||
|
||||
int problem = 0;
|
||||
Hsp_iterator hi;
|
||||
int i = 0;
|
||||
for(hi = hsp.begin(); hi != hsp.end(); ++hi) {
|
||||
std::cerr << "polyhedron " << ++i << std::endl;
|
||||
const Plane_list& bad = *hi;
|
||||
if(hi == hsp.begin()) {
|
||||
if(!test_point_in_polyhedron(p, *hi, turn_hull)) {
|
||||
++hi;
|
||||
CGAL_assertion(hi->size() == 0);
|
||||
if(!test_point_in_polyhedron(p, bad, emptyList, turn_hull)) {
|
||||
++problem;
|
||||
std::cerr << "point not in hull " << std::endl;
|
||||
}
|
||||
} else {
|
||||
if(test_point_in_polyhedron(p, *hi, turn_obs)) {
|
||||
++hi;
|
||||
const Plane_list& good = *hi;
|
||||
if(test_point_in_polyhedron(p, bad, good, turn_obs)) {
|
||||
++problem;
|
||||
std::cerr << "point inside obstacle " << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue