We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › 3D shape library - now available
Pages: 1 2 3 
3D shape library - now available (Read 11658 times)
3D shape library - now available
Dec 13th, 2009, 11:14am
 
I know Processing provides box() and sphere() but I thought it would be nice to be able to create other 3D shapes such as a Helix, Cone, Tube etc. Not just that but provide support for textures (including tiling). The library supports both P3D and OPENGL but only uses commands available in Processing rather than using direct OpenGL access so should be compatible with future versions of Processing.

Anyway the library is simple to use, to find out more and see some examples head over to http://www.lagers.org.uk/s3d4p/index.html then click on the Examples link. Have a look at the Processing source code for Showcase and Earth & Moon to see how easy it is too use.

As and when I create new examples I will post links here.  

Enjoy Cheesy

Re: 3D shape library - now available
Reply #1 - Dec 13th, 2009, 12:01pm
 
Thank you. this is really useful i guess. I missed these features in the past. especially when i started working with processing. By now i have some code snippeds that allow me to add a cone myself for example. but i believe this is something that should be added to processing itself
Re: 3D shape library - now available
Reply #2 - Dec 14th, 2009, 2:44am
 
looks great and well done, love the examples.
Re: 3D shape library - now available
Reply #3 - Dec 14th, 2009, 4:18am
 
i just found out about the bezier shape editor. Thats great. This is a solution to a question that was asked several times in the past. From now on i will just point to your library Smiley
Re: 3D shape library - now available
Reply #4 - Dec 14th, 2009, 9:45am
 
Very nice.  Your GUI library looks great as well.
Re: 3D shape library - now available
Reply #5 - Dec 14th, 2009, 11:38am
 
Glad you all like the new library I intend to continue development so would be interested in any ideas e.g. new shapes, functionality etc. that anyone might come up with.
Smiley
Re: 3D shape library - now available
Reply #6 - Dec 27th, 2009, 10:51am
 
great examples! its great that it supports textures too.
Re: 3D shape library - now available
Reply #7 - Dec 30th, 2009, 3:15pm
 
hi thanks for the library. works great. a question though:
how would one go about including say for example Cone in a class? if i use "this" it doesn't work
Re: 3D shape library - now available
Reply #8 - Dec 31st, 2009, 1:51am
 
When creating any of the shapes using the new command the first parameter is a reference to the PApplet object where it will be drawn. Since most shapes will be created inside the sketch main tab (or if using another IDE such as Eclipse the class that extends PApplet) then using 'this' is fine.

Lets say you want to create a class called Foo and in this class you want to create a Cone then

Code:

public class Foo{
 private PApplet app;
 private Cone cone;

 public Foo(PApplet papplet){
   app = papplet;
 }

 public void makeCone(){
   cone = new Cone(app, 20);
 }

}


In your main sketch you might have
Code:

void setup(){
 size(200,200,P3D);
 Foo foo = new Foo(this);
 foo.makeCone();
}

Smiley

Later today I hope to release the next version of this library and the enhancements include 3D terrain and shape picking so watch out for the announcement in the Exhibition discourse.
Cheesy
Re: 3D shape library - now available
Reply #9 - Dec 31st, 2009, 3:37am
 
Sounds great Quark. looking forward to check it out.
Re: 3D shape library - now available
Reply #10 - Jan 6th, 2010, 6:37pm
 
Great, thanks for clearing that up Quark. And thanks for the library.

one other question:
if i had to make a class out of an object, eg. Cone, is there a way of adding it to another shape

void setup(){
 size(200,200,P3D);
 Foo foo = new Foo(this);
 foo.makeCone();
earth = new Ellipsoid(this, 20 ,30);
earth.addShape(foo);
}

Re: 3D shape library - now available
Reply #11 - Jan 7th, 2010, 4:44am
 
Sorry that not possible only shapes in the library can be added to another shape. So we could add the Cone but not the Foo.

Are these basically what if questions or is there something specific you are trying to do, if the later then a bit of info and I could probably give more informed help.

Are you working to the latest version of the library it is now at  V1.5.1 which has improved texturing and for some shapes the ability to control which parts are drawn, as well as a terrain class.
Smiley
Re: 3D shape library - now available
Reply #12 - Jan 10th, 2010, 5:30pm
 
Quark, on the earth example.  Just wondering if it would be possible to determine long and lat, and identify points on the texture.  So like add an identify for NYC.

I'd love to do something like this
http://senseable.mit.edu/nyte/images/01%20nyte%20-%20globe%20encounters.jpg
Re: 3D shape library - now available
Reply #13 - Jan 11th, 2010, 1:09am
 
Unfortunately not although it should be possible to create a class that inherits from the Ellipsoid class to provide that functionality but it would be challenging to implement.
Re: 3D shape library - now available
Reply #14 - Jan 11th, 2010, 1:33am
 
Why not. If the coords are in degree, it should be quite easy to locate points a sphere. Take look at this formula: http://local.wasp.uwa.edu.au/~pbourke/geometry/prolatespheroid/.
Think lat as theta and long as phi.
Pages: 1 2 3