Coder Social home page Coder Social logo

campskeleton's People

Contributors

gustl22 avatar next-mad-hatter avatar twak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

campskeleton's Issues

Everything's fine

Hello,

thanks a lot once again for sharing your implementation.
_066 (just to shows that it is running smoothly on linux)

It seems that you have chosen to avoid "split events" by reducing the length of the median when it crosses an edge. I like the approach.
_067

I've worked on a c++ implementation of straight skeletons, but I had logical issues when solving the intersections. I guess you solved it in your code :)
I'll let you know as soon I'm starting to work again on my code.

All the best,

francois z.

Polygons with holes

yes it works with holes, they have to defined as a separate loop in a backwards direction

I'm following this but I'm unable to get it to behave with holes. I've tried every combination of exterior & interior coordinates directions. Examples:

No hole

image

Exterior loop CCW, interior loop (hole) CW

exCCWinCW

Exterior loop CCW, interior loop CCW

exCCWinCCW

Exterior loop CW, interior loop CCW

exCWinCCW

Exterior loop CW, interior loop CW

exCWinCW

Code

Polygon polygon;
Machine speed = new Machine(1); // every edge same speed
Skeleton skeleton;
LoopL<org.twak.camp.Edge> loopL = new LoopL<>(); // list of loops
ArrayList<Corner> corners = new ArrayList<>();
Loop<org.twak.camp.Edge> loop = new Loop<>();

LinearRing exterior = polygon.getExteriorRing();
if (!Orientation.isCCW(exterior.getCoordinates())) {
	exterior = exterior.reverse(); // exterior should be CCW
}

Coordinate[] coords = exterior.getCoordinates();
for (int j = 0; j < coords.length - 1; j++) {
	double a = coords[j].x;
	double b = coords[j].y;
	corners.add(new Corner(a, b));
}
for (int j = 0; j < corners.size() - 1; j++) {
	org.twak.camp.Edge edge = new org.twak.camp.Edge(corners.get(j),
			corners.get((j + 1) % (corners.size() - 1)));
	edge.machine = speed;
	loop.append(edge);
}
loopL.add(loop);

for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
	corners = new ArrayList<>();
	LinearRing hole = polygon.getInteriorRingN(i);
	if (Orientation.isCCW(hole.getCoordinates())) {
		hole = hole.reverse(); // holes should be clockwise
	}
	for (int j = 0; j < hole.getNumPoints() - 1; j++) {
		corners.add(new Corner(hole.getCoordinates()[j].x, hole.getCoordinates()[j].y));
	}
	loop = new Loop<>();
	for (int j = 0; j < corners.size() - 1; j++) {
		org.twak.camp.Edge edge = new org.twak.camp.Edge(corners.get(j),
				corners.get((j + 1) % (corners.size() - 1)));
		edge.machine = speed;
		loop.append(edge);
	}
	loopL.add(loop);
}

Jitpack build issue with jutils dependency

I recently had a few projects that rely on camp-skeleton (master branch) fail to build.
After looking into it, I've found it's an issue on jitpack with the current master version of jutils.

campskeleton has a dependency on jutils version master-SNAPSHOT; this label currently points to master-198bbef5f6-1, and this is currently giving problems:

Go to https://jitpack.io/com/github/twak/jutils/master-198bbef5f6-1/ and we see the error:

File not found. Build ok

Could not resolve dependecies on maven install.

If I run mvn install I get these message:

The following artifacts could not be resolved:
org.twak.utils:utils:jar:0.0.1-SNAPSHOT,
org.twak.campskeleton:campskeleton:jar:0.0.1-SNAPSHOT

I wonder, because in the past it worked for me.
This happens with other projects like siteplan or chordatlas.

All other dependencies are fetched with maven correctly.

License

Hi,
what is the license for your/the campskeleton code?

Get bones, edges and branches separately

Is it possible to get these three things separately from skeleton.output?

Atm I'm using skeleton.output.edges.map.values() and testing whether the coordinates start and end for each edge are contained in the set of vertices (corners) to determine the status of the edge โ€” is there a direct way?

image
(edges: purple; bones: black; branches: pink)

shrink needs a stopgap too

Hi,
Your OffsetSkeleton code appears to be broken. Running the attached file 
with the current source earns me a ClassCastException.

Exception in thread "main" java.lang.ClassCastException: 
straightskeleton.Edge cannot be cast to straightskeleton.Corner
     at straightskeleton.CornerClone.<init>(CornerClone.java:67)
     at straightskeleton.OffsetSkeleton.<init>(OffsetSkeleton.java:49)
     at straightskeleton.OffsetSkeleton.shrink(OffsetSkeleton.java:249)
     at main.Main.main(Main.java:33)

Looking through debug, I found that LoopL<Corner> input was actually a 
LoopL<Edge>, which was odd. I'd say that ought to be checked somehow but 
I know fuck all about generics. However if you look at 
OffsetSkeleton.shrink you'll notice the LoopL<Edge> in is indeed being 
passed into CornerClone as though it were a LoopL<Corner>.

In your regular Skeleton I noticed the SetupForEdges method and comment, 
and rightly guessed that shrink needed a stopgap as well. A copy/paste 
of that method's body into shrink fixed it for me, and it's now running 
properly.

Just thought you should know. This is the only robust Java 
implementation of inset shapes I've found on the whole internet, and I 
hate installing CGAL/Boost for little things like this.

-Nick Parker

Original issue reported on code.google.com by [email protected] on 4 Dec 2014 at 1:53

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.