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

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

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

Vertex.getX介绍

暂无

代码示例

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

/**
 * Computes the inner or dot product
 * 
 * @param v a vertex
 * @return returns the dot product u.v
 */
double dot(Vertex v) {
  return (p.x * v.getX() + p.y * v.getY());
}

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

public boolean equals(Vertex _x) {
  if (p.x == _x.getX() && p.y == _x.getY()) {
    return true;
  } else {
    return false;
  }
}

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

/**
 * Computes the cross product k = u X v.
 * 
 * @param v a vertex
 * @return returns the magnitude of u X v
 */
double crossProduct(Vertex v) {
  return (p.x * v.getY() - p.y * v.getX());
}

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

private double distance(Vertex v1, Vertex v2) {
  return Math.sqrt(Math.pow(v2.getX() - v1.getX(), 2.0)
      + Math.pow(v2.getY() - v1.getY(), 2.0));
}

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

private HCoordinate bisector(Vertex a, Vertex b) {
  // returns the perpendicular bisector of the line segment ab
  double dx = b.getX() - a.getX();
  double dy = b.getY() - a.getY();
  HCoordinate l1 = new HCoordinate(a.getX() + dx / 2.0, a.getY() + dy / 2.0, 1.0);
  HCoordinate l2 = new HCoordinate(a.getX() - dy + dx / 2.0, a.getY() + dx + dy / 2.0, 1.0);
  return new HCoordinate(l1, l2);
}

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

Vertex sum(Vertex v) {
  return (new Vertex(p.x + v.getX(), p.y + v.getY()));
}

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

Vertex sub(Vertex v) {
  return (new Vertex(p.x - v.getX(), p.y - v.getY()));
}

代码示例来源: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

/**
 * 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

public int classify(Vertex p0, Vertex p1) {
  Vertex p2 = this;
  Vertex a = p1.sub(p0);
  Vertex b = p2.sub(p0);
  double sa = a.crossProduct(b);
  if (sa > 0.0)
    return LEFT;
  if (sa < 0.0)
    return RIGHT;
  if ((a.getX() * b.getX() < 0.0) || (a.getY() * b.getY() < 0.0))
    return BEHIND;
  if (a.magn() < b.magn())
    return BEYOND;
  if (p0.equals(p2))
    return ORIGIN;
  if (p1.equals(p2))
    return DESTINATION;
  return BETWEEN;
}

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

/**
 * Computes the centre of the circumcircle of this vertex and two others.
 * 
 * @param b
 * @param c
 * @return the Coordinate which is the circumcircle of the 3 points.
 */
public Vertex circleCenter(Vertex b, Vertex c) {
  Vertex a = new Vertex(this.getX(), this.getY());
  // compute the perpendicular bisector of cord ab
  HCoordinate cab = bisector(a, b);
  // compute the perpendicular bisector of cord bc
  HCoordinate cbc = bisector(b, c);
  // compute the intersection of the bisectors (circle radii)
  HCoordinate hcc = new HCoordinate(cab, cbc);
  Vertex cc = null;
  try {
    cc = new Vertex(hcc.getX(), hcc.getY());
  } catch (NotRepresentableException nre) {
    System.err.println("a: " + a + "  b: " + b + "  c: " + c);
    System.err.println(nre);
  }
  return cc;
}

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

public boolean equals(Vertex _x) {
  if (p.x == _x.getX() && p.y == _x.getY()) {
    return true;
  } else {
    return false;
  }
}

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

/**
 * Computes the cross product k = u X v.
 * 
 * @param v a vertex
 * @return returns the magnitude of u X v
 */
double crossProduct(Vertex v) {
  return (p.x * v.getY() - p.y * v.getX());
}

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

/**
 * Computes the inner or dot product
 * 
 * @param v a vertex
 * @return returns the dot product u.v
 */
double dot(Vertex v) {
  return (p.x * v.getX() + p.y * v.getY());
}

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

private double distance(Vertex v1, Vertex v2) {
  return Math.sqrt(Math.pow(v2.getX() - v1.getX(), 2.0)
      + Math.pow(v2.getY() - v1.getY(), 2.0));
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

private static ConcaveHull computeConcaveHull(List<QuadEdge> orderedBorderEdges)
{
 List<Point2D> orderedConcaveHullVertices = orderedBorderEdges.stream()
                                .map(QuadEdge::orig)
                                .map(vertex -> new Point2D(vertex.getX(), vertex.getY()))
                                .collect(Collectors.toList());
 return new ConcaveHull(orderedConcaveHullVertices);
}

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

private HCoordinate bisector(Vertex a, Vertex b) {
  // returns the perpendicular bisector of the line segment ab
  double dx = b.getX() - a.getX();
  double dy = b.getY() - a.getY();
  HCoordinate l1 = new HCoordinate(a.getX() + dx / 2.0, a.getY() + dy / 2.0, 1.0);
  HCoordinate l2 = new HCoordinate(a.getX() - dy + dx / 2.0, a.getY() + dx + dy / 2.0, 1.0);
  return new HCoordinate(l1, l2);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

private static Point2D toPoint2d(Vertex vertex)
{
 return new Point2D(vertex.getX(), vertex.getY());
}

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

Vertex sum(Vertex v) {
  return (new Vertex(p.x + v.getX(), p.y + v.getY()));
}

代码示例来源: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);
}

相关文章