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

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

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

Vertex.<init>介绍

暂无

代码示例

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

/**
 * Computes the scalar product c(v)
 * 
 * @param v a vertex
 * @return returns the scaled vector
 */
Vertex times(double c) {
  return (new Vertex(c * p.x, c * p.y));
}

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

Vertex cross() {
  return (new Vertex(p.y, -p.x));
}

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

/**
 * Converts all {@link Coordinate}s in a collection to {@link Vertex}es.
 * @param coords the coordinates to convert
 * @return a List of Vertex objects
 */
public static List toVertices(Collection coords)
{
  List verts = new ArrayList();
  for (Iterator i = coords.iterator(); i.hasNext(); ) {
    Coordinate coord = (Coordinate) i.next();
    verts.add(new Vertex(coord));
  }
  return verts;
}

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

/**
 * Finds a quadedge of a triangle containing a location
 * specified by a {@link Coordinate}, if one exists.
 * 
 * @param p the Coordinate to locate
 * @return a quadedge on the edge of a triangle which touches or contains the location
 * or null if no such triangle exists
 */
public QuadEdge locate(Coordinate p) {
  return locator.locate(new Vertex(p));
}

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

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

private void createFrame(Envelope env)
{
  double deltaX = env.getWidth();
  double deltaY = env.getHeight();
  double offset = 0.0;
  if (deltaX > deltaY) {
    offset = deltaX * 10.0;
  } else {
    offset = deltaY * 10.0;
  }
  frameVertex[0] = new Vertex((env.getMaxX() + env.getMinX()) / 2.0, env
      .getMaxY()
      + offset);
  frameVertex[1] = new Vertex(env.getMinX() - offset, env.getMinY() - offset);
  frameVertex[2] = new Vertex(env.getMaxX() + offset, env.getMinY() - offset);
  frameEnv = new Envelope(frameVertex[0].getCoordinate(), frameVertex[1]
      .getCoordinate());
  frameEnv.expandToInclude(frameVertex[2].getCoordinate());
}

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

/**
 * Computes the scalar product c(v)
 * 
 * @param v a vertex
 * @return returns the scaled vector
 */
Vertex times(double c) {
  return (new Vertex(c * p.x, c * p.y));
}

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

Vertex cross() {
  return (new Vertex(p.y, -p.x));
}

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

public void visit(QuadEdge[] triEdges) 
  {
    Coordinate a = triEdges[0].orig().getCoordinate();
    Coordinate b = triEdges[1].orig().getCoordinate();
    Coordinate c = triEdges[2].orig().getCoordinate();
    
    // TODO: choose the most accurate circumcentre based on the edges
 Coordinate cc = Triangle.circumcentre(a, b, c);
    Vertex ccVertex = new Vertex(cc);
    // save the circumcentre as the origin for the dual edges originating in this triangle
    for (int i = 0; i < 3; i++) {
      triEdges[i].rot().setOrig(ccVertex);
    }
  }
}

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

/**
 * Locates the edge between the given vertices, if it exists in the
 * subdivision.
 * 
 * @param p0 a coordinate
 * @param p1 another coordinate
 * @return the edge joining the coordinates, if present
 * or null if no such edge exists
 */
public QuadEdge locate(Coordinate p0, Coordinate p1) {
  // find an edge containing one of the points
  QuadEdge e = locator.locate(new Vertex(p0));
  if (e == null)
    return null;
  // normalize so that p0 is origin of base edge
  QuadEdge base = e;
  if (e.dest().getCoordinate().equals2D(p0))
    base = e.sym();
  // check all edges around origin of base edge
  QuadEdge locEdge = base;
  do {
    if (locEdge.dest().getCoordinate().equals2D(p1))
      return locEdge;
    locEdge = locEdge.oNext();
  } while (locEdge != base);
  return null;
}

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

/**
 * Converts all {@link Coordinate}s in a collection to {@link Vertex}es.
 * @param coords the coordinates to convert
 * @return a List of Vertex objects
 */
public static List toVertices(Collection coords)
{
  List verts = new ArrayList();
  for (Iterator i = coords.iterator(); i.hasNext(); ) {
    Coordinate coord = (Coordinate) i.next();
    verts.add(new Vertex(coord));
  }
  return verts;
}

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

/**
 * Finds a quadedge of a triangle containing a location
 * specified by a {@link Coordinate}, if one exists.
 * 
 * @param p the Coordinate to locate
 * @return a quadedge on the edge of a triangle which touches or contains the location
 * or null if no such triangle exists
 */
public QuadEdge locate(Coordinate p) {
  return locator.locate(new Vertex(p));
}

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

Vertex sub(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);
}

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

private void createFrame(Envelope env)
{
  double deltaX = env.getWidth();
  double deltaY = env.getHeight();
  double offset = 0.0;
  if (deltaX > deltaY) {
    offset = deltaX * 10.0;
  } else {
    offset = deltaY * 10.0;
  }
  frameVertex[0] = new Vertex((env.getMaxX() + env.getMinX()) / 2.0, env
      .getMaxY()
      + offset);
  frameVertex[1] = new Vertex(env.getMinX() - offset, env.getMinY() - offset);
  frameVertex[2] = new Vertex(env.getMaxX() + offset, env.getMinY() - offset);
  frameEnv = new Envelope(frameVertex[0].getCoordinate(), frameVertex[1]
      .getCoordinate());
  frameEnv.expandToInclude(frameVertex[2].getCoordinate());
}

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

public void visit(QuadEdge[] triEdges) 
  {
    Coordinate a = triEdges[0].orig().getCoordinate();
    Coordinate b = triEdges[1].orig().getCoordinate();
    Coordinate c = triEdges[2].orig().getCoordinate();
    
    // TODO: choose the most accurate circumcentre based on the edges
 Coordinate cc = Triangle.circumcentre(a, b, c);
    Vertex ccVertex = new Vertex(cc);
    // save the circumcentre as the origin for the dual edges originating in this triangle
    for (int i = 0; i < 3; i++) {
      triEdges[i].rot().setOrig(ccVertex);
    }
  }
}

相关文章