miho / JCSG

Java implementation of BSP based CSG (Constructive Solid Geometry)
Other
178 stars 54 forks source link

Feature request: Processing library #8

Closed hamoid closed 9 years ago

hamoid commented 10 years ago

Many people would be really happy if a CSG library existed for Processing. Just saying ;)

Processing (processing.org) is based in Java 7. I took a look at porting the code myself, but first I would have to study how to port Java 8 code to Java 7. Would that be a complicated task? Never did Java 8.

I think a possible Processing CSG library would include only a subset of the JCSG features, since it's already possible to create spheres, cubes, and other shapes, it's easy to display them simply by calling shape(myShape), where myShape is of type PShape. Processing has many 3D libraries available with mesh generation features (http://hg.postspectacular.com/toxiclibs/, http://hemesh.wblut.com/ and others), which offer iso surfaces, convex hull, polyhedrons, tubes, bending, stretching, and other kinds of distortion. Only CSG is missing :)

Are there plans for such a Processing library? Otherwise, do you know of a Java 8 to 7 translation guide?

Thanks!

miho commented 10 years ago

Hi,

to be honest, I didn't think about Processing. Would you use a Java 7 port? If so, I can help you with the port. It shouldn't be complicated.

hamoid commented 10 years ago

Hi! Thanks for the quick reply. I would be very happy with a Java 7 port :) I can maybe maintain a parallel Java 7 version, or maybe build the Processing library myself.

Initially I loaded the project in Eclipse without realizing the Java 8 requirement and saw 997 errors, but I guess they all belong to a few categories of expressions that don't exist in 7.

The first issues I encounter are these:

return p.vertices.stream().allMatch(v -> contains(v));
csg.polygons = polygonStream.map((Polygon p) -> p.clone()).collect(Collectors.toList());
materialNames.keySet().forEach(s -> { .... });

I understand what they do from other languages I've used. But what's the easiest way to do this on 7?

miho commented 10 years ago

Hi,

I've just commited a Java 7 port (java7 branch). Hope it works :) It's untested.

You can contribute the processing related code to the java7 branch if you like.

hamoid commented 10 years ago

Awesome! Thanks! Will try it out and report back :)

miho commented 9 years ago

No activity.