Skip to content

Commit 4b395e0

Browse files
committed
Merge branch 'solid-nef-fix'
2 parents 3fa01cf + 601554f commit 4b395e0

File tree

12 files changed

+227
-266
lines changed

12 files changed

+227
-266
lines changed

README.md

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
Validation of 3D primitives according to the international standard ISO 19107.
44

5-
Its main aim is the 3D primitives of GML (`<gml:Solid>`, `<gml:CompositeSurface>`, or `<gml:MultiSurface>`), but it can be used to validate any 3D primitive.
5+
The 3D primitives of GML (`<gml:Solid>`, `<gml:CompositeSurface>`, or `<gml:MultiSurface>`) are what it was built for, but it can be used to validate any 3D primitive, also in other formats.
66
It accepts as input any GML files (or one of the formats built upon it, such as CityGML), OBJ, OFF, and [POLY](http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual006.html#ff_poly).
77
It simply scans the file looking for the 3D primitives and validates these according to the rules in ISO19107 (all the rest is ignored).
8+
In a OBJ/OFF/STL file, each primitive will be validated according to the ISO 19107 rules.
89

910
For `Solids`, the validation is performed hierarchically, ie first every polygon (embedded in 3D) is validated (by projecting it to a 2D plane and using [GEOS](http://trac.osgeo.org/geos/)), then every shell is validated (must be watertight, no self-intersections, orientation of the normals must be consistent and pointing outwards, etc), and finally the interactions between the shells are analysed.
1011
This means that if a polygon of your solid is not valid, the validator will report that error but will *not* continue the validation (to avoid "cascading" errors).
@@ -13,14 +14,15 @@ For `CompositeSurfaces`, the surface formed by the polygons must be a 2-manifold
1314

1415
For `MultiSurfaces`, only the validation of the individual polygons is performed, ie are they valid according to the 2D rules, and are they planar?
1516

16-
Most of the details are available in this scientific article:
17+
Most of the details are available in this scientific article, (if you use val3dity for scientific purposes please cite this article):
1718

1819
> Ledoux, Hugo (2013). On the validation of solids represented with the
1920
international standards for geographic information. *Computer-Aided Civil and Infrastructure Engineering*, 28(9):693-706. [ [PDF] ](https://3d.bk.tudelft.nl/hledoux/pdfs/13_cacaie.pdf) [ [DOI] ](http://dx.doi.org/10.1111/mice.12043)
2021

22+
2123
## Web application
2224

23-
If you're running Windows and/or you don't want to go through the troubles of compiling, we suggest you use the [web application](http://geovalidation.bk.tudelft.nl/val3dity).
25+
If you're you don't want to go through the troubles of compiling and/or installing val3dity, we suggest you use the [web application](http://geovalidation.bk.tudelft.nl/val3dity).
2426
You upload your file to our server and get a validation report back.
2527
We delete the file as soon as it has been validated.
2628
However, a file is limited to 50MB.
@@ -30,7 +32,7 @@ However, a file is limited to 50MB.
3032

3133
It is a command-line program, which we provide as source code, with CMake.
3234
It's trivial to compile under Mac and Linux.
33-
For Windows, we do not offer binaries at this moment, but compiling it is possible with the CMake.
35+
[For Windows, we do offer an executable](https://github.com/tudelft3d/val3dity/releases).
3436

3537
To compile val3dity yourself, you first need to install the following free libraries:
3638

@@ -87,60 +89,16 @@ See the [FAQ for the web application](http://geovalidation.bk.tudelft.nl/val3dit
8789

8890
## Options for validating
8991

90-
It is possible to define 2 tolerances for the planarity of surfaces with the flags
92+
It is possible to define 2 tolerances for the planarity of surfaces with the flags:
9193

9294
1. `--planarity_d2s` the distance between every point forming a surface and a plane is less than a given tolerance (eg 1cm, which is the default).
9395
1. `--planarity_n` the surface is triangulated and the normal of each triangle must not deviate more than than a certain usef-defined tolerance (eg 1 degree, which is the default).
9496

95-
Similarly, the input points in a GML files are snapped together using a tolerance, which can be changed with `--snap_tolerance` (default is 1mm)
97+
Similarly, the input points in a GML files are snapped together using a tolerance, which can be changed with `--snap_tolerance` (default is 1mm).
9698

9799
## Error reported
98100

99-
(a description of each error is available [here](https://github.com/tudelft3d/val3dity/blob/master/errors_description/errors_description.md))
100-
101-
### Ring level
102-
103-
* 101: TOO_FEW_POINTS
104-
* 102: CONSECUTIVE_POINTS_SAME
105-
* 103: NOT_CLOSED
106-
* 104: SELF_INTERSECTION
107-
* 105: COLLAPSED_TO_LINE
108-
109-
110-
### POLYGON level
111-
112-
* 201: INTERSECTION_RINGS
113-
* 202: DUPLICATED_RINGS
114-
* 203: NON_PLANAR_POLYGON_DISTANCE_PLANE
115-
* 204: NON_PLANAR_POLYGON_NORMALS_DEVIATION
116-
* 205: INTERIOR_DISCONNECTED
117-
* 206: HOLE_OUTSIDE
118-
* 207: INNER_RINGS_NESTED
119-
* 208: ORIENTATION_RINGS_SAME
101+
![](https://dl.dropboxusercontent.com/u/8129172/errorcodes.png)
120102

103+
(a description of each error is available [here](https://github.com/tudelft3d/val3dity/blob/master/errors_description/errors_description.md))
121104

122-
### SHELL level
123-
124-
* 301: TOO_FEW_POLYGONS
125-
* 302: NOT_CLOSED
126-
* 303: NON_MANIFOLD_VERTEX
127-
* 304: NON_MANIFOLD_EDGE
128-
* 305: SEPARATE_PARTS
129-
* 306: SELF_INTERSECTION
130-
* 307: POLYGON_WRONG_ORIENTATION
131-
* 308: ALL_POLYGONS_WRONG_ORIENTATION
132-
* 309: VERTICES_NOT_USED
133-
134-
135-
### SOLID level
136-
137-
* 401: SHELLS_FACE_ADJACENT
138-
* 402: SHELL_INTERIOR_INTERSECT
139-
* 403: INNER_SHELL_OUTSIDE_OUTER
140-
* 404: INTERIOR_OF_SHELL_NOT_CONNECTED
141-
142-
### OTHERS
143-
144-
* 901: INVALID_INPUT_FILE
145-
* 902: EMPTY_PRIMITIVE
146-
* 999: UNKNOWN_ERROR

Shell.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ bool Shell::construct_ct(const vector< vector<int> >& pgnids, const vector<Polyg
373373
}
374374

375375

376-
void Shell::translate_vertices()
376+
void Shell::get_min_bbox(double& x, double& y)
377377
{
378378
vector<Point3>::iterator it = _lsPts.begin();
379379
K::FT minx = 9e10;
@@ -385,6 +385,14 @@ void Shell::translate_vertices()
385385
if (it->y() < miny)
386386
miny = it->y();
387387
}
388+
x = minx;
389+
y = miny;
390+
}
391+
392+
393+
void Shell::translate_vertices(double minx, double miny)
394+
{
395+
vector<Point3>::iterator it = _lsPts.begin();
388396
for (it = _lsPts.begin(); it != _lsPts.end(); it++)
389397
{
390398
Point3 tp(CGAL::to_double(it->x() - minx), CGAL::to_double(it->y() - miny), CGAL::to_double(it->z()));
@@ -645,12 +653,6 @@ bool Shell::validate_as_shell(double tol_planarity_d2p, double tol_planarity_nor
645653
std::clog << "--Geometrical consistency" << std::endl;
646654
if (is_polyhedron_geometrically_consistent(this) == false)
647655
return false;
648-
//-- 4. orientation of the normals is outwards or inwards
649-
std::clog << "--Orientation of normals" << std::endl;
650-
if (check_global_orientation_normals(_polyhedron, this->is_outer()) == false) {
651-
this->add_error(308);
652-
return false;
653-
}
654656
return true;
655657
}
656658

Shell.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Shell
3636

3737
int number_vertices();
3838
int number_faces();
39+
void get_min_bbox(double& x, double& y);
3940
bool is_outer();
4041
int get_id();
4142
CgalPolyhedron* get_cgal_polyhedron();
@@ -51,7 +52,7 @@ class Shell
5152
void add_error(int code, std::string faceid = "", std::string info = "");
5253
bool has_errors();
5354
std::set<int> get_unique_error_codes();
54-
void translate_vertices();
55+
void translate_vertices(double minx, double miny);
5556
std::string get_poly_representation();
5657

5758
private:

0 commit comments

Comments
 (0)