Git Product home page Git Product logo

jdelaunay's Introduction

jdelaunay

This project is no longer being actively developed or maintained.

For more efficient delaunay triangulation library please go to https://github.com/orbisgis/poly2tri.java

Library in Java dedicated to the processing of Delaunay and constrained Delaunay triangulations.

jDelaunay is under GPLv3 licence.

See the wiki page for more details.

jdelaunay's People

Contributors

agouge avatar ebocher avatar gourlaysama avatar nicolas-f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdelaunay's Issues

Segment de contrainte modifié par JDelaunay

package org.noisemap.core;

import com.vividsolutions.jts.geom.Coordinate;

import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.algorithm.CGAlgorithms;
import org.jdelaunay.delaunay.geometries.DTriangle;

import java.util.List;


import junit.framework.TestCase;

/**
 *
 * @author SU Qi
 */
public class TestJDelaunayTriangleDirectionChanged extends TestCase{
    public void testTriangleDirectionChangedByJDelaunay() throws LayerDelaunayError{
           GeometryFactory factory = new GeometryFactory();
           Coordinate[] building1Coords = { new Coordinate(15., 5.,0.),
                new Coordinate(30., 5.,0.), new Coordinate(30., 30.,0.),
                new Coordinate(15., 30.,0.), new Coordinate(15., 5.,0.) };
           Polygon building1 = factory.createPolygon(
            factory.createLinearRing(building1Coords), null);
           LayerJDelaunay jDelaunay=new LayerJDelaunay();
           jDelaunay.addPolygon(building1, true, 1);
           jDelaunay.setMinAngle(0.);
       jDelaunay.setRetrieveNeighbors(true);
       jDelaunay.processDelaunay();
           List<DTriangle> triangle=jDelaunay.gettriangletest();
           //-1 no triangle
           //0 triangle ccw
           //1 triangle cw
           //2 one building, triangles have different directions
           int ccw=-1;                                
           for(DTriangle t:triangle){
               Coordinate [] ring = new Coordinate []{t.getPoint(0).getCoordinate(),t.getPoint(1).getCoordinate(),t.getPoint(2).getCoordinate(),t.getPoint(0).getCoordinate()};
               if(ccw==-1){
                   if(CGAlgorithms.isCCW(ring)){
                       ccw=0;
                   }
                   else{
                       ccw=1;
                   }
               }
               else if(ccw!=-1){
                   if(ccw==0&&!CGAlgorithms.isCCW(ring)||ccw==1&&CGAlgorithms.isCCW(ring)){
                       ccw=2;
                       break;
                   }

               }
           }
           System.out.println("triangle directions are:");
           switch(ccw){
               case 0:
                   System.out.println("CCW");
                   break;
               case 1:
                   System.out.println("CW");
                   break;
               case 2:
                   throw new LayerDelaunayError("Constraint's segment modified by JDelaunay");
           }





    }
}

Quand je fais le maillage, j'ai trouvé les triangles dans un même bâtiment mais les sens de ces triangles ne sont pas le même, je ne suis pas sûr si c'est un bug de JDelaunay ou pas, peut-être il exist un paramètre ou qqch pour éviter ce problème?

ENGLISH VERSION:
When computing the mesh, I found triangles with different orientation in a given building. I'm not sure whether it is a JDelauany bug or not. Maybe can I use a parameter to avoid this problem ?

Is Point property changed by Jdelaunay when the two building are glued?

Hello, I have 2 buildings like this

           Coordinate[] building1Coords = { new Coordinate(15., 5.,0.),
                new Coordinate(30., 5.,0.), new Coordinate(30., 30.,0.),
                new Coordinate(15., 30.,0.), new Coordinate(15., 5.,0.) };
           Coordinate[] building2Coords = { new Coordinate(30., 5.,0.),
                new Coordinate(45., 5.,0.), new Coordinate(45., 45.,0.),
                new Coordinate(30., 45.,0.), new Coordinate(30., 5.,0.) };

To save these two buildings, i give every DPoint of the building a same ID used the parameter "property". Like building1, every point i give "property=1" and building2 "property=2"
When the two building are separated, this "property" not changed but when the two building are glued, the intersected point, like Point(30., 5.,0.) in exemple, his "property" will be changed from "2" to "3".
I know after JDelaunay the intersected point will used just one time, so the point list changed liked this one:

[Point 8 [0.0 0.0 0.0], Point 9 [0.0 60.0 0.0], Point 1 [15.0 5.0 0.0], Point 2 [15.0 30.0 0.0], Point 4 [30.0 5.0 0.0], Point 3 [30.0 30.0 0.0], Point 7 [30.0 45.0 0.0], Point 5 [45.0 5.0 0.0], Point 6 [45.0 45.0 0.0], Point 11 [60.0 0.0 0.0], Point 10 [60.0 60.0 0.0]] 

In fact i dont want to merge this two building before the JDelaunay cuz they have different height so i want to keep these two buildings independent

Using "property", how can i avoid this problem ?

Hope my question is clear... Thank you

Not concave Polygon

Sorry when i process triangulation I only get convex polygon. Whenever the new Edge makes polygon concave that edge is no counted. Could you tell me what the problem is

Geometries need cleaning to save memory

A single point contains the following attributes:

  • gid int (belongs to super class element)
  • property int (belongs to super class element)
  • externalGID int (belongs to super class element)
  • height double (belongs to super class element)
  • coord Coordinate (double, double, double)

Height property seems not be used. property, externalGID and height are rarely used and should be optional (in external array and using gid as key)

Add 1.0.0 to Maven?

I know it's been some time since this has been updated, but I'll ask:
Is there any chance the latest repository version could be published to Maven Central?

The latest release on Maven is 0.5.3 and it seems that some things have changed since then.

Thanks.

Delaunay triangulation robustness

In some cases, the delaunay triangulation is incorrect.

It's difficult to describe the bug because it depends on the spatial data distribution. However, the library creates a non-conform mesh. Some triangles are lost, do not respect the delaunay properties...

The triangulation can be tested in OrbisGIS v4 using the syntax bellow

SELECT * FROM ST_TIN(points);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.