Examples of ConvexHull


Examples of com.nr.cg.Convexhull

    Ran myran = new Ran(17);
    for (i=0;i<N;i++) {
      pvec[i].x[0]=myran.doub();
      pvec[i].x[1]=myran.doub();
    }
    Convexhull cvx=new Convexhull(pvec);

    // Hull should be close to unit square
//    System.out.printf(cvx.nhull);
    double[] a=new double[4],dis=new double[cvx.nhull];
    for (i=0;i<cvx.nhull;i++) {
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

  }

  private void computeConvexHull() {
    GeometryFactory fact = new GeometryFactory();
    Coordinate[] coords = getPointArray();
    ConvexHull hull = new ConvexHull(coords, fact);
    convexHull = hull.getConvexHull();
  }
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

    public Object evaluate(Object[] args) throws TypeErrorException
    {
        if(args.length==1)
        {
            Geometry geo = GeoHelper.getGeoSPARQLGeometry(args[0]);
            ConvexHull hull = new ConvexHull(geo);
            Geometry convexHullGeo = hull.getConvexHull();
            return new GeoSPARQLWktSerializer().toLiteral(convexHullGeo);
        }
        else
        {
            throw new TypeErrorException("ConvexHull Function expects exactly 1 arguments: A geometry.");
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

  }

  private void computeConvexHull() {
    GeometryFactory fact = new GeometryFactory();
    Coordinate[] coords = getPointArray();
    ConvexHull hull = new ConvexHull(coords, fact);
    convexHull = hull.getConvexHull();
  }
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

   *
   * @param geometry
   * @return
   */
  private LinearRing getConvexHull(Geometry geometry) {
    return getOuterLinearRingFromGeometry((new ConvexHull(geometry)).getConvexHull());
  }
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

        int mainComponentIndex = -1;
        int component = 0;
        for (Integer key : componentCoordinates.keySet()) {
            List<Coordinate> coords = componentCoordinates.get(key);
            Coordinate[] coordArray = new Coordinate[coords.size()];
            ConvexHull hull = new ConvexHull(coords.toArray(coordArray), GeometryUtils.getGeometryFactory());
            Geometry geom = hull.getConvexHull();
            // buffer components which are mere lines so that they do not disappear.
            if (geom instanceof LineString) {
                geom = geom.buffer(0.01); // ~10 meters
            } else if (geom instanceof Point) {
                geom = geom.buffer(0.05); // ~50 meters, so that it shows up
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

        GeometryCollection geometries = new GeometryCollection(points, gf);
        return geometries;
    }

    public static Geometry makeConvexHull(Graph graph) {
        return new ConvexHull(geometryCollectionFromVertices(graph)).getConvexHull();
    }
View Full Code Here

Examples of com.vividsolutions.jts.algorithm.ConvexHull

  public void testManyIdenticalPoints() throws Exception {
    Coordinate[] pts = new Coordinate[100];
    for (int i = 0; i < 99; i++)
      pts[i] = new Coordinate(0,0);
    pts[99] = new Coordinate(1,1);
    ConvexHull ch = new ConvexHull(pts, geometryFactory);
    Geometry actualGeometry = ch.getConvexHull();
    Geometry expectedGeometry = reader.read("LINESTRING (0 0, 1 1)");
    assertEquals(expectedGeometry.toString(), actualGeometry.toString());
  }
View Full Code Here

Examples of de.fhpotsdam.unfolding.examples.overviewdetail.connection.ConvexHull

  public void setup() {
    size(500, 500);
    background(255);
    smooth();
   
    convexHull = new ConvexHull(this);
    convexHull.showDebugPoints = true;
    convexHull.addPoint(new PVector(random(width), random(height)));
    convexHull.addPoint(new PVector(random(width), random(height)));
    convexHull.addPoint(new PVector(random(width), random(height)));
  }
View Full Code Here

Examples of jinngine.geometry.ConvexHull

      vertices.add( new Vector3( -0.5, -0.50.5));
      vertices.add( new Vector30.50.5, -0.5));
      vertices.add( new Vector3( -0.50.5, -0.5));
      vertices.add( new Vector30.5, -0.5, -0.5));
      vertices.add( new Vector3( -0.5, -0.5, -0.5));
      final ConvexHull hull = new ConvexHull(vertices);
     
      toDraw.add( new DrawShape() {   
        @Override
        public Iterator<Vector3[]> getFaces() {
          return hull.getFaces();
        }
        @Override
        public Matrix4 getTransform() {
          return g.getTransform();
        }
        @Override
        public Body getReferenceBody() {
          return g.getBody();
        }
      });
    }
   
    if ( g instanceof UniformCapsule  ) {
      UniformCapsule cap = (UniformCapsule)g;
      final List<Vector3> vertices = new ArrayList<Vector3>();
      final List<Vector3> icoicosahedron = new ArrayList<Vector3>();
     
      // point on icosahedron
//      final double t = (1.0 + Math.sqrt(5.0))/ 2.0;
//      final double S = 1.0 / ( Math.sqrt(1+t*t));
//      icoicosahedron.add(new Vector3(-1,  t,  0));
//      icoicosahedron.add( new Vector3( 1,  t,  0));
//      icoicosahedron.add( new Vector3(-1, -t,  0));
//      icoicosahedron.add( new Vector3( 1, -t,  0));
//      icoicosahedron.add( new Vector3( 0, -1,  t));
//      icoicosahedron.add( new Vector3( 0,  1,  t));
//      icoicosahedron.add( new Vector3( 0, -1, -t));
//      icoicosahedron.add( new Vector3( 0,  1, -t));
//      icoicosahedron.add( new Vector3( t,  0, -1));
//      icoicosahedron.add( new Vector3( t,  0,  1));
//      icoicosahedron.add( new Vector3(-t,  0, -1));
//      icoicosahedron.add( new Vector3(-t,  0,  1));

      ConvexHull icosphere = buildIcosphere(1, 2);
     
      // scale to unit
//      for (Vector3 v: icoicosahedron)
//        v.assign(v.multiply(S) );

      // add two icos to vertices
      Iterator<Vector3> iter = icosphere.getVertices();
      while(iter.hasNext()) {
        Vector3 v = iter.next();
        vertices.add( v.multiply(cap.getRadius()).add(0,0,cap.getLength()/2));
        vertices.add( v.multiply(cap.getRadius()).add(0,0,-cap.getLength()/2));
      }
       
      final ConvexHull hull = new ConvexHull(vertices);
     
      toDraw.add( new DrawShape() {   
        @Override
        public Iterator<Vector3[]> getFaces() {
          return hull.getFaces();
        }
        @Override
        public Matrix4 getTransform() {
          return g.getTransform();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.