[Jts-topo-suite-user] QuadEdge wrong value From: SK - 2013-06-20 22:23 Attachments: Message as HTML ```Hi, I have simple test data //[[(x, y, (sin x -sin y)*10)| x <- [-6..6]] | y <- [-3..3]] static String sinXminusSinY = "MULTIPOINT (" + " (-6.0 -3.0 4.205355062587931 )," + "(-5.0 -3.0 11.000442827230057 )," + "(-4.0 -3.0 8.979225033677954 )," + "(-3.0 -3.0 0.0 )," + "(-2.0 -3.0 -7.681774187658145 )," + "(-1.0 -3.0 -7.003509767480293 )," + "(0.0 -3.0 1.4112000805986722 )," + "(1.0 -3.0 9.825909928677637 )," + "(2.0 -3.0 10.50417434885549 )," + "(3.0 -3.0 2.8224001611973444 )," + "(4.0 -3.0 -6.15682487248061 )," + "(5.0 -3.0 -8.178042666032713 )," + "(6.0 -3.0 -1.3829549013905864) ," etc Next I triangulate this and get subdivision QuadEdgeSubdivision subdiv = builder.getSubdivision(); Now I need to fill an array [-6, 6]x[-3, 3] and I try to interpolate my data in cycle double val = interpolateZ(subdiv, new Coordinate(myX, myY)); //(I found this on Stackoverflow) public static double interpolateZ(QuadEdgeSubdivision quadEdgeSubdivision, Coordinate coordinate) { QuadEdge edge = quadEdgeSubdivision.locate(coordinate); System.out.println(edge.toString());///!!!See below return new Vertex(coordinate.x, coordinate.y).interpolateZValue(edge.orig(), edge.dest(), edge.oNext().dest()); } But I have a NaN processing column of my sample data. When I print edge I get strange result. I have no any 126, 123 in my programm. LINESTRING ( -126.0 -123.0, -6.0 -3.0 ) LINESTRING ( -126.0 -123.0, -6.0 -2.0 ) LINESTRING ( -126.0 -123.0, -6.0 -1.0 ) LINESTRING ( -126.0 -123.0, -6.0 0.0 ) LINESTRING ( -126.0 -123.0, -6.0 1.0 ) LINESTRING ( -126.0 -123.0, -6.0 2.0 ) LINESTRING ( -126.0 -123.0, -6.0 3.0 ) Is it normal or I did something wrong? Thank you CK ```
 Re: [Jts-topo-suite-user] QuadEdge wrong value From: Martin Davis - 2013-06-20 22:27 Attachments: Message as HTML ```If you can provide runnable Java test code that will make it easier to help. On Thu, Jun 20, 2013 at 3:23 PM, SK wrote: > Hi, > I have simple test data > //[[(x, y, (sin x -sin y)*10)| x <- [-6..6]] | y <- [-3..3]] > static String sinXminusSinY = "MULTIPOINT (" > + " (-6.0 -3.0 4.205355062587931 )," > + "(-5.0 -3.0 11.000442827230057 )," > + "(-4.0 -3.0 8.979225033677954 )," > + "(-3.0 -3.0 0.0 )," > + "(-2.0 -3.0 -7.681774187658145 )," > + "(-1.0 -3.0 -7.003509767480293 )," > + "(0.0 -3.0 1.4112000805986722 )," > + "(1.0 -3.0 9.825909928677637 )," > + "(2.0 -3.0 10.50417434885549 )," > + "(3.0 -3.0 2.8224001611973444 )," > + "(4.0 -3.0 -6.15682487248061 )," > + "(5.0 -3.0 -8.178042666032713 )," > + "(6.0 -3.0 -1.3829549013905864) ," etc > > Next I triangulate this and get subdivision > > QuadEdgeSubdivision subdiv = builder.getSubdivision(); > > Now I need to fill an array [-6, 6]x[-3, 3] > > and I try to interpolate my data in cycle > double val = interpolateZ(subdiv, new Coordinate(myX, myY)); > > //(I found this on Stackoverflow) > public static double interpolateZ(QuadEdgeSubdivision quadEdgeSubdivision, > Coordinate coordinate) { > QuadEdge edge = quadEdgeSubdivision.locate(coordinate); > System.out.println(edge.toString());///!!!See below > return new Vertex(coordinate.x, > coordinate.y).interpolateZValue(edge.orig(), edge.dest(), > edge.oNext().dest()); > } > > But I have a NaN processing column of my sample data. > When I print edge I get strange result. I have no any 126, 123 in my > programm. > LINESTRING ( -126.0 -123.0, -6.0 -3.0 ) > LINESTRING ( -126.0 -123.0, -6.0 -2.0 ) > LINESTRING ( -126.0 -123.0, -6.0 -1.0 ) > LINESTRING ( -126.0 -123.0, -6.0 0.0 ) > LINESTRING ( -126.0 -123.0, -6.0 1.0 ) > LINESTRING ( -126.0 -123.0, -6.0 2.0 ) > LINESTRING ( -126.0 -123.0, -6.0 3.0 ) > > Is it normal or I did something wrong? > Thank you > CK > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > ```
 Re: [Jts-topo-suite-user] QuadEdge wrong value From: Martin Davis - 2013-07-01 15:29 Attachments: Message as HTML ```The reason for the appearance of the extra vertices is that the Delaunay algorithm surrounds the input data with a known-convex "frame", in order to simplify the processing. These vertices are part of the frame. (See QuadEdgeSubdivision.createFrame - which also provides methods to test whether a Vertex is part of the frame). Sorry for the delay in replying. On Fri, Jun 21, 2013 at 12:05 AM, SK wrote: > Hi, this is test example -- it gives same strange results. > > import com.vividsolutions.jts.geom.Coordinate; > import com.vividsolutions.jts.geom.Envelope; > import com.vividsolutions.jts.geom.Geometry; > import com.vividsolutions.jts.geom.MultiPoint; > import com.vividsolutions.jts.io.WKTReader; > import com.vividsolutions.jts.triangulate.DelaunayTriangulationBuilder; > import com.vividsolutions.jts.triangulate.quadedge.QuadEdge; > import com.vividsolutions.jts.triangulate.quadedge.QuadEdgeSubdivision; > import com.vividsolutions.jts.triangulate.quadedge.Vertex; > import java.util.ArrayList; > > /** > * > * @author karasiov > */ > public class QuadEdgeTest { > > public static void main(String[] args) throws Exception{ > > WKTReader w = new WKTReader(); > Geometry g = w.read(sinXminusSinY); > DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder(); > > MultiPoint mpt = (MultiPoint)g; > builder.setSites(mpt); > QuadEdgeSubdivision subdiv = builder.getSubdivision(); > > Envelope env = mpt.getEnvelopeInternal(); > > System.out.println(env); > ArrayList lat = new ArrayList(); > ArrayList lon = new ArrayList(); > for(int i = -6; i<7;i++ ){lat.add(i);} > for(int i = -3; i<4;i++ ){lon.add(i);} > > double[][] iso = new double[lon.size()][lat.size()]; > > for(int a=0; a for(int o=0; o double val = interpolateZ(subdiv, new > Coordinate(lat.get(a), lon.get(o))); > //System.out.println(val); > } > > } > } > > public static double interpolateZ(QuadEdgeSubdivision quadEdgeSubdivision, > Coordinate coordinate) { > QuadEdge edge = quadEdgeSubdivision.locate(coordinate); > System.out.println(edge); > return new Vertex(coordinate.x, > coordinate.y).interpolateZValue(edge.orig(), edge.dest(), > edge.oNext().dest()); > } > //[[(x, y, (sin x -sin y)*10)| x <- [-6..6]] | y <- [-3..3]] > static String sinXminusSinY = "MULTIPOINT (" > + " (-6.0 -3.0 4.205355062587931 )," > + "(-5.0 -3.0 11.000442827230057 )," > + "(-4.0 -3.0 8.979225033677954 )," > + "(-3.0 -3.0 0.0 )," > + "(-2.0 -3.0 -7.681774187658145 )," > + "(-1.0 -3.0 -7.003509767480293 )," > + "(0.0 -3.0 1.4112000805986722 )," > + "(1.0 -3.0 9.825909928677637 )," > + "(2.0 -3.0 10.50417434885549 )," > + "(3.0 -3.0 2.8224001611973444 )," > + "(4.0 -3.0 -6.15682487248061 )," > + "(5.0 -3.0 -8.178042666032713 )," > + "(6.0 -3.0 -1.3829549013905864) ," > + "(-6.0 -2.0 11.887129250246076 )," > + "(-5.0 -2.0 18.682217014888202 )," > + "(-4.0 -2.0 16.6609992213361 )," > + "(-3.0 -2.0 7.681774187658145 )," > + "(-2.0 -2.0 0.0 )," > + "(-1.0 -2.0 0.678264420177852 )," > + "(0.0 -2.0 9.092974268256818 )," > + "(1.0 -2.0 17.50768411633578 )," > + "(2.0 -2.0 18.185948536513635 )," > + "(3.0 -2.0 10.50417434885549 )," > + "(4.0 -2.0 1.524949315177535 )," > + "(5.0 -2.0 -0.49626847837456745 )," > + "(6.0 -2.0 6.298819286267559) ," > + "(-6.0 -1.0 11.208864830068224 )," > + "(-5.0 -1.0 18.00395259471035 )," > + "(-4.0 -1.0 15.982734801158248 )," > + "(-3.0 -1.0 7.003509767480293 )," > + "(-2.0 -1.0 -0.678264420177852 )," > + "(-1.0 -1.0 0.0 )," > + "(0.0 -1.0 8.414709848078965 )," > + "(1.0 -1.0 16.82941969615793 )," > + "(2.0 -1.0 17.50768411633578 )," > + "(3.0 -1.0 9.825909928677637 )," > + "(4.0 -1.0 0.846684894999683 )," > + "(5.0 -1.0 -1.1745328985524195 )," > + "(6.0 -1.0 5.620554866089707) ," > + "(-6.0 0.0 2.7941549819892586 )," > + "(-5.0 0.0 9.589242746631385 )," > + "(-4.0 0.0 7.5680249530792825 )," > + "(-3.0 0.0 -1.4112000805986722 )," > + "(-2.0 0.0 -9.092974268256818 )," > + "(-1.0 0.0 -8.414709848078965 )," > + "(0.0 0.0 0.0 )," > + "(1.0 0.0 8.414709848078965 )," > + "(2.0 0.0 9.092974268256818 )," > + "(3.0 0.0 1.4112000805986722 )," > + "(4.0 0.0 -7.5680249530792825 )," > + "(5.0 0.0 -9.589242746631385 )," > + "(6.0 0.0 -2.7941549819892586) ," > + "(-6.0 1.0 -5.620554866089707 )," > + "(-5.0 1.0 1.1745328985524195 )," > + "(-4.0 1.0 -0.846684894999683 )," > + "(-3.0 1.0 -9.825909928677637 )," > + "(-2.0 1.0 -17.50768411633578 )," > + "(-1.0 1.0 -16.82941969615793 )," > + "(0.0 1.0 -8.414709848078965 )," > + "(1.0 1.0 0.0 )," > + "(2.0 1.0 0.678264420177852 )," > + "(3.0 1.0 -7.003509767480293 )," > + "(4.0 1.0 -15.982734801158248 )," > + "(5.0 1.0 -18.00395259471035 )," > + "(6.0 1.0 -11.208864830068224) ," > + "(-6.0 2.0 -6.298819286267559 )," > + "(-5.0 2.0 0.49626847837456745 )," > + "(-4.0 2.0 -1.524949315177535 )," > + "(-3.0 2.0 -10.50417434885549 )," > + "(-2.0 2.0 -18.185948536513635 )," > + "(-1.0 2.0 -17.50768411633578 )," > + "(0.0 2.0 -9.092974268256818 )," > + "(1.0 2.0 -0.678264420177852 )," > + "(2.0 2.0 0.0 )," > + "(3.0 2.0 -7.681774187658145 )," > + "(4.0 2.0 -16.6609992213361 )," > + "(5.0 2.0 -18.682217014888202 )," > + "(6.0 2.0 -11.887129250246076) ," > + "(-6.0 3.0 1.3829549013905864 )," > + "(-5.0 3.0 8.178042666032713 )," > + "(-4.0 3.0 6.15682487248061 )," > + "(-3.0 3.0 -2.8224001611973444 )," > + "(-2.0 3.0 -10.50417434885549 )," > + "(-1.0 3.0 -9.825909928677637 )," > + "(0.0 3.0 -1.4112000805986722 )," > + "(1.0 3.0 7.003509767480293 )," > + "(2.0 3.0 7.681774187658145 )," > + "(3.0 3.0 0.0 )," > + "(4.0 3.0 -8.979225033677954 )," > + "(5.0 3.0 -11.000442827230057 )," > + "(6.0 3.0 -4.205355062587931))"; > } > > > > On Fri, Jun 21, 2013 at 2:27 AM, Martin Davis wrote: > >> If you can provide runnable Java test code that will make it easier to >> help. >> >> >> On Thu, Jun 20, 2013 at 3:23 PM, SK wrote: >> >>> Hi, >>> I have simple test data >>> //[[(x, y, (sin x -sin y)*10)| x <- [-6..6]] | y <- [-3..3]] >>> static String sinXminusSinY = "MULTIPOINT (" >>> + " (-6.0 -3.0 4.205355062587931 )," >>> + "(-5.0 -3.0 11.000442827230057 )," >>> + "(-4.0 -3.0 8.979225033677954 )," >>> + "(-3.0 -3.0 0.0 )," >>> + "(-2.0 -3.0 -7.681774187658145 )," >>> + "(-1.0 -3.0 -7.003509767480293 )," >>> + "(0.0 -3.0 1.4112000805986722 )," >>> + "(1.0 -3.0 9.825909928677637 )," >>> + "(2.0 -3.0 10.50417434885549 )," >>> + "(3.0 -3.0 2.8224001611973444 )," >>> + "(4.0 -3.0 -6.15682487248061 )," >>> + "(5.0 -3.0 -8.178042666032713 )," >>> + "(6.0 -3.0 -1.3829549013905864) ," etc >>> >>> Next I triangulate this and get subdivision >>> >>> QuadEdgeSubdivision subdiv = builder.getSubdivision(); >>> >>> Now I need to fill an array [-6, 6]x[-3, 3] >>> >>> and I try to interpolate my data in cycle >>> double val = interpolateZ(subdiv, new Coordinate(myX, myY)); >>> >>> //(I found this on Stackoverflow) >>> public static double interpolateZ(QuadEdgeSubdivision >>> quadEdgeSubdivision, Coordinate coordinate) { >>> QuadEdge edge = quadEdgeSubdivision.locate(coordinate); >>> System.out.println(edge.toString());///!!!See below >>> return new Vertex(coordinate.x, >>> coordinate.y).interpolateZValue(edge.orig(), edge.dest(), >>> edge.oNext().dest()); >>> } >>> >>> But I have a NaN processing column of my sample data. >>> When I print edge I get strange result. I have no any 126, 123 in my >>> programm. >>> LINESTRING ( -126.0 -123.0, -6.0 -3.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 -2.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 -1.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 0.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 1.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 2.0 ) >>> LINESTRING ( -126.0 -123.0, -6.0 3.0 ) >>> >>> Is it normal or I did something wrong? >>> Thank you >>> CK >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Windows: >>> >>> Build for Windows Store. >>> >>> http://p.sf.net/sfu/windows-dev2dev >>> _______________________________________________ >>> Jts-topo-suite-user mailing list >>> Jts-topo-suite-user@... >>> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >>> >>> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> _______________________________________________ >> Jts-topo-suite-user mailing list >> Jts-topo-suite-user@... >> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >> >> > ```