Questions tagged [path-iterator]

11 questions
2
votes
1 answer

Using PathIterator to return all line segments that constrain an Area?

In Java, how would one employ PathIterator to iterate through the line segments that constrain an Area? The Area is bound only by lines (but curve support wouldn't hurt). The method should return a collection of all the line segments.
Peter
  • 4,021
  • 5
  • 37
  • 58
2
votes
1 answer

Java PathIterator clockwise or counterclockwise?

Does a Java PathIterator give you the points of a Polygon in clockwise or counterclockwise order?
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
1
vote
3 answers

Java PathIterator - How do I accurately calculate center of Shape object?

I am trying to use the PathIterator to calculate the center of any Shape object, so that curved paths can be accounted for, but upon finding the center of a standard 1x1 rectangle, my getCenter() method returns the…
Colebertio
  • 15
  • 5
1
vote
0 answers

Java PathIterator - How do I find the correct perimeter of an area?

The premise I am randomly generating a two-dimensional mazelike structure. It boils down to randomly generating a bunch of rooms in the grid, then randomly connecting these rooms with corridors using A*. The rooms have walls that take up an entire…
WafflesTasty
  • 248
  • 1
  • 2
  • 7
1
vote
1 answer

Can't figure out what flattnes parameter does in PathIterator?

I am writing my own PathIterator implementation. Currently I implemented method with flatness with flatness-less one: @Override public PathIterator getPathIterator(AffineTransform at, double flatness) { return getPathIterator(at); } i.e. I am…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
0
votes
1 answer

Getting the coordinate pairs of a Path2D object in Java?

I have to get the coordinates of each set of coordinates in a Path2D object but I don't know how. Previously we were using Polygons, so I was able to initialize two arrays of length Polygon.npoints and then set them to be the Polygon.xpoints and…
wfgeo
  • 2,716
  • 4
  • 30
  • 51
0
votes
1 answer

PathIterator for java.awt.Rectangle always gives (0,0)

In my code, I create an instance of java.awt.Rectangle with a corner and length and width. Then I apply a rotation affine transformation(at) on it to rotate it by a certain angle. Then I fetch rectangle's PathIterator and iterate the geometry…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
1 answer

The method currentSegment(float[]) in the type PathIterator is not applicable for the arguments (Double[])

I am trying to read the Segments of an Path2D.Double in an java Programm and Eclips keeps telling me: The method currentSegment(float[]) in the type PathIterator is not applicable for the arguments (Double[]) But in the interface PathIterator there…
0
votes
0 answers

Java Retrieve simple coordinates to text in TextLayout

I have a function that retrieves the Shape of a string: private Shape getTextShape(String str, Font font) { BufferedImage bufferImage = new BufferedImage(2,2,BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferImage.createGraphics(); …
0
votes
0 answers

How to compute the smallest common denominator of a set of paths and symlinks in PHP?

I get an array of paths (combined from default and user settings) and need to perform a recursive search for some data files which can be hidden between tens of thousands of of files in any of these paths. I do the recursive search with a…
wedi
  • 1,332
  • 1
  • 13
  • 28
-1
votes
1 answer

How to check for Shape intersection using GeneralPath? Java

I have a program that allows you to move various Shapes about. I want to be able to return a boolean that returns true if two shapes are intersecting. This is what I have thus far: public boolean overlaps(MyShape s){ Rectangle2D.Double…
varatis
  • 14,494
  • 23
  • 71
  • 114