com.vividsolutions.jts.triangulate.quadedge.Vertex.getZ()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中com.vividsolutions.jts.triangulate.quadedge.Vertex.getZ()方法的一些代码示例,展示了Vertex.getZ()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getZ()方法的具体详情如下:
包路径:com.vividsolutions.jts.triangulate.quadedge.Vertex
类名称:Vertex
方法名:getZ

Vertex.getZ介绍

暂无

代码示例

代码示例来源:origin: com.vividsolutions/jts

/**
 * For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate
 * a z value from the surrounding vertices.
 */
public double interpolateZValue(Vertex v0, Vertex v1, Vertex v2) {
  double x0 = v0.getX();
  double y0 = v0.getY();
  double a = v1.getX() - x0;
  double b = v2.getX() - x0;
  double c = v1.getY() - y0;
  double d = v2.getY() - y0;
  double det = a * d - b * c;
  double dx = this.getX() - x0;
  double dy = this.getY() - y0;
  double t = (d * dx - b * dy) / det;
  double u = (-c * dx + a * dy) / det;
  double z = v0.getZ() + t * (v1.getZ() - v0.getZ()) + u * (v2.getZ() - v0.getZ());
  return z;
}

代码示例来源:origin: com.vividsolutions/jts

/**
 * returns a new vertex that is mid-way between this vertex and another end point.
 * 
 * @param a the other end point.
 * @return the point mid-way between this and that.
 */
public Vertex midPoint(Vertex a) {
  double xm = (p.x + a.getX()) / 2.0;
  double ym = (p.y + a.getY()) / 2.0;
  double zm = (p.z + a.getZ()) / 2.0;
  return new Vertex(xm, ym, zm);
}

代码示例来源:origin: com.vividsolutions/jts-core

/**
 * For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate
 * a z value from the surrounding vertices.
 */
public double interpolateZValue(Vertex v0, Vertex v1, Vertex v2) {
  double x0 = v0.getX();
  double y0 = v0.getY();
  double a = v1.getX() - x0;
  double b = v2.getX() - x0;
  double c = v1.getY() - y0;
  double d = v2.getY() - y0;
  double det = a * d - b * c;
  double dx = this.getX() - x0;
  double dy = this.getY() - y0;
  double t = (d * dx - b * dy) / det;
  double u = (-c * dx + a * dy) / det;
  double z = v0.getZ() + t * (v1.getZ() - v0.getZ()) + u * (v2.getZ() - v0.getZ());
  return z;
}

代码示例来源:origin: com.vividsolutions/jts-core

/**
 * returns a new vertex that is mid-way between this vertex and another end point.
 * 
 * @param a the other end point.
 * @return the point mid-way between this and that.
 */
public Vertex midPoint(Vertex a) {
  double xm = (p.x + a.getX()) / 2.0;
  double ym = (p.y + a.getY()) / 2.0;
  double zm = (p.z + a.getZ()) / 2.0;
  return new Vertex(xm, ym, zm);
}

代码示例来源:origin: matsim-org/matsim

continue;
processed.add(e);
int cut = cut(e.orig().getZ(), e.dest().getZ(), z0);
if (cut == 0) {
  continue; // While, next edge
  QuadEdge E1 = ccw ? e.oNext().getPrimary() : e.oPrev().getPrimary();
  QuadEdge E2 = ccw ? e.dPrev().getPrimary() : e.dNext().getPrimary();
  int cut1 = E1 == null ? 0 : cut(E1.orig().getZ(), E1.dest().getZ(), z0);
  int cut2 = E2 == null ? 0 : cut(E2.orig().getZ(), E2.dest().getZ(), z0);
  boolean ok1 = cut1 != 0 && !processed.contains(E1);
  boolean ok2 = cut2 != 0 && !processed.contains(E2);

相关文章