twak / campskeleton Goto Github PK
View Code? Open in Web Editor NEWweighted straight skeleton java implementation
License: Apache License 2.0
weighted straight skeleton java implementation
License: Apache License 2.0
hi twak,
get results like the ones here:
https://doc.cgal.org/latest/Surface_mesh_skeletonization/index.html
is it possible to represent a curved line of ae shape with vertices close to each other?
thanks!
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?
Missing twak utils in hacking branch.
Thank you
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:
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);
}
Hello,
thanks a lot once again for sharing your implementation.
(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.
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.
http://twak.blogspot.com/2009/05/engineering-weighted-straight-skeleton.html this blog image is missing.(can not find your email so using issue instead)
Hi,
what is the license for your/the campskeleton code?
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:
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.
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
this issue can be deleted
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.