I have a polygon having a linearRing boundary which is parsed from citygml. Using citygml4j library, I got all 3d postions of the linearRing.

From these positions, anyone who knows how can i parse them into triangles to build a custom meshe (like this https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes ) ?

Remember that these positions are located in the boundary of the polygon, does not inside the polygon.

Thanks for any suggestions.

Do i need some methods “Polygon triangulation” to do it ?

In computational geometry, polygon triangulation is the decomposition of a polygonal area (simple polygon) P into a set of triangles, i.e., finding a set of triangles with pairwise non-intersecting interiors whose union is P.
Triangulations may be viewed as special cases of planar straight-line graphs. When there are no holes or added points, triangulations form maximal outerplanar graphs.
Over time, a number of algorithms have been proposed to triangulate a polygon.
It is trivial to triangula...

If yes, which method is best suit ? any one who know library name or java code example to do it ? Thanks for any reponse.

pspeed
October 17, 2013, 4:15pm
3
Do your polygons have holes? In the end it sort of depends on your skill level for implementing the algorithm. I don’t know if anyone has posted a general polygon triangulation yet.

In the end it’s just a matter of simplicity to code versus performance requirements. I think the ear clipping method could be pretty simple and pretty fast, though.

Tks for your reponse quickly. No, my polygon has not any holes. They’re simple polygons. I have heard about clipping method.

I google a source like this

```
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.math;
import com.badlogic.gdx.utils.FloatArray;
import com.badlogic.gdx.utils.IntArray;
```

This file has been truncated. show original

I try it firstly.

Finally, i got it. I used library QuickHull3D (http://www.cs.ubc.ca/~lloyd/java/quickhull3d.html ) to triangles all vertices and it works.