File tree 3 files changed +36
-4
lines changed
src/main/java/eu/mihosoft/jcsg
3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ plugins {
2
2
id ' application'
3
3
id ' java'
4
4
id ' maven-publish'
5
- id ' net.nemerosa.versioning' version ' 1.5.0 '
6
- id ' com.jfrog.bintray' version ' 1.6 '
5
+ id ' net.nemerosa.versioning' version ' 2.6.1 '
6
+ id ' com.jfrog.bintray' version ' 1.7.2 '
7
7
}
8
8
9
9
sourceCompatibility = ' 1.8'
@@ -13,7 +13,7 @@ sourceCompatibility = '1.8'
13
13
// repairHeaders.licenseHeaderText = new File(projectDir,'./license-template.txt')
14
14
15
15
task wrapper (type : Wrapper , description : ' Creates and deploys the Gradle wrapper to the current directory.' ) {
16
- gradleVersion = ' 4.0 '
16
+ gradleVersion = ' 4.6 '
17
17
}
18
18
19
19
if (! hasProperty(' mainClass' )) {
Original file line number Diff line number Diff line change 1
1
group = eu.mihosoft.vrl.jcsg
2
- version = 0.5.7-SNAPSHOT
2
+ version = 0.5.7
Original file line number Diff line number Diff line change @@ -272,6 +272,38 @@ public StringBuilder toStlString(StringBuilder sb) {
272
272
return sb ;
273
273
}
274
274
275
+ /**
276
+ * Returns a triangulated version of this polygon.
277
+ *
278
+ * @return triangles
279
+ */
280
+ public List <Polygon > toTriangles () {
281
+
282
+ List <Polygon > result = new ArrayList <>();
283
+
284
+ if (this .vertices .size () >= 3 ) {
285
+
286
+ // TODO: improve the triangulation?
287
+ //
288
+ // If our polygon has more vertices, create
289
+ // multiple triangles:
290
+ Vertex firstVertexStl = this .vertices .get (0 );
291
+ for (int i = 0 ; i < this .vertices .size () - 2 ; i ++) {
292
+
293
+ // create triangle
294
+ Polygon polygon = Polygon .fromPoints (
295
+ firstVertexStl .pos ,
296
+ this .vertices .get (i + 1 ).pos ,
297
+ this .vertices .get (i + 2 ).pos
298
+ );
299
+
300
+ result .add (polygon );
301
+ }
302
+ }
303
+
304
+ return result ;
305
+ }
306
+
275
307
/**
276
308
* Translates this polygon.
277
309
*
You can’t perform that action at this time.
0 commit comments