I need a java library that draws a 2D polygon in 3D canvas, given the corner points.

Every single tutorial about jzy3d, j3d, jmathplot etc is about drawing 3D objects in 3D canvas. Also, the tutorials usually include moving ect.

I only need to draw a 2D polygon in 3D canvas


All of the above tools can draw a 2D polygon on the 3D Canvas - just draw it as a 3D object with one of the dimensions, (usually z since you have x & y), set to zero.

To detail what I mean is you have the coordinates that make up a square, (2D), and those coordinates are [(10,10), (60, 10), (60, 60), (10, 06)] then making a 3D Object with the coordinates [(10,10,0), (60, 10,0), (60, 60,0), (10, 06,0)] will give you a 2D i.e. Flat object in 3D space.

  • I could not find such feature for jmathplot. – padawan Dec 14 '14 at 12:23
  • @cagirici - expanded a little above to try to make it clearer. – Steve Barnes Dec 14 '14 at 14:04
  • What if I need to draw a square which is not on z=0 plane? Is it still possible? – padawan Dec 15 '14 at 20:53
  • Sure - just use some trig, simplest would be a simple z offset but you can apply any transformation you need or, in most libraries define the square as above, (in it's local coordinates), then transition &/or rotate in global coordinates. – Steve Barnes Dec 15 '14 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.