public override void StartRun(int npts) { iter = 0; precisionModel = new PrecisionModel(PREC_SCALE_FACTOR); geomA = SineStarFactory.Create(new Coordinate(ORG_X, ORG_Y), SIZE, npts, N_ARMS, ARM_RATIO); int nptsB = npts / NUM_CASES; if (nptsB < 10) { nptsB = 10; } geomB = createTestGeoms(NUM_CASES, nptsB); TestContext.WriteLine("\n------- Running with A: # pts = " + npts + " B # pts = " + nptsB); if (npts == 999) { TestContext.WriteLine(geomA); foreach (var g in geomB) { TestContext.WriteLine(g); } } }
public override void StartRun(int npts) { _sineStar = SineStarFactory.Create(new Coordinate(OriginX, OriginY), Size, npts, NumberOfArms, ArmRatio); _sinePolyCrinkly = GeometryPrecisionReducer.Reduce(_sineStar, new PrecisionModel(Size)); Console.WriteLine(); Console.WriteLine($"Running with # pts {_sinePolyCrinkly.NumPoints}"); ////if (npts <= 1000) Console.WriteLine(_sineStar); }
private static IGeometry CreateSineStar(Coordinate origin, double size, int nPts) { var gsf = new SineStarFactory { Centre = origin, Size = size, NumPoints = nPts, ArmLengthRatio = 2, NumArms = 20 }; var poly = gsf.CreateSineStar(); return(poly); }
public RandomGeometryHelper(IGeometryFactory factory) { Factory = factory; _geometricShapeFactory = new SineStarFactory(factory); CreateCoordinate = () => new Coordinate(); Ordinates = Ordinates.XY; MinX = -180; MaxX = 180; MinY = -90; MaxY = 90; }
private static IGeometry CreateLine(Coordinate @base, double size, int nPts) { var gsf = new SineStarFactory(); gsf.Centre = @base; gsf.Size = size; gsf.NumPoints = nPts; var circle = gsf.CreateSineStar(); // System.out.println(circle); return(circle.Boundary); }
private static Geometry CreateSineStar(int nPts, double offset) { var gsf = new SineStarFactory(); gsf.Centre = new Coordinate(0, offset); gsf.Size = 100; gsf.NumPoints = nPts; var g = gsf.CreateSineStar(); return(g); }
private static IGeometry CreateSineStar(Coordinate origin, double size, int nPts) { var gsf = new SineStarFactory(); gsf.Centre = origin; gsf.Size = size; gsf.NumPoints = nPts; gsf.ArmLengthRatio = 0.1; gsf.NumArms = 50; var poly = gsf.CreateSineStar(); return(poly); }
Geometry CreateSineStar(int nPts, double offset) { var gsf = new SineStarFactory(); //gsf.Centre = new Coordinate(0, 0); gsf.Size = SIZE; gsf.NumPoints = nPts; gsf.Centre = new Coordinate(0, offset); var g2 = gsf.CreateSineStar().Boundary; return(g2); }
public IGeometry CreateSineStar(int nPts) { var gsf = new SineStarFactory(_geomFact); gsf.Centre = _origin; gsf.Size = _size; gsf.NumPoints = nPts; gsf.ArmLengthRatio = 0.1; gsf.NumArms = 20; var poly = gsf.CreateSineStar(); return(poly); }
private Geometry[] createTestGeoms(int nGeoms, int npts) { var geoms = new Geometry[NUM_CASES]; int index = 0; for (int i = 0; i < GRID_SIZE; i++) { for (int j = 0; j < GRID_SIZE; j++) { double x = GRID_CELL_SIZE / 2 + i * GRID_CELL_SIZE; double y = GRID_CELL_SIZE / 2 + j * GRID_CELL_SIZE; var geom = SineStarFactory.Create(new Coordinate(x, y), GRID_CELL_SIZE, npts, N_ARMS, ARM_RATIO); geoms[index++] = geom; } } return(geoms); }
public void TestShapefile(string shapefile) { if (!System.IO.File.Exists(shapefile)) { throw new IgnoreException("file not present"); } var featureCollection = new Collection <IFeature>(); Envelope bbox; //using (var shp = new IO.ShapeFile.Extended.ShapeDataReader(shapefile)) var shp = new Extended.ShapeDataReader(shapefile); //{ bbox = shp.ShapefileBounds; foreach (var shapefileFeature in shp.ReadByMBRFilter(shp.ShapefileBounds)) { featureCollection.Add(shapefileFeature); } //} const double min1 = 0.4; const double min2 = 0.5 - min1; var rnd = new System.Random(8888); var queryBox = new Envelope( bbox.MinX + (min1 + rnd.NextDouble() * min2) * bbox.Width, bbox.MaxX - (min1 + rnd.NextDouble() * min2) * bbox.Width, bbox.MinY + (min1 + rnd.NextDouble() * min2) * bbox.Height, bbox.MaxY - (min1 + rnd.NextDouble() * min2) * bbox.Height); var shape = new SineStarFactory(GeometryFactory.Default) { Envelope = queryBox }.CreateSineStar(); TestShapefilePlain(featureCollection, shape, "intersects"); TestShapefilePlain(featureCollection, shape, "intersects"); TestShapefilePrepared(featureCollection, shape, "intersects"); TestShapefileIndexed(featureCollection, shape, "intersects"); shp.Dispose(); }