开发者

Looking for simple 3D Java lib [closed]

开发者 https://www.devze.com 2023-01-20 06:24 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

Problem: I have to plot a simple 3D graph/diagram with x,y,z coordinates given for some points. My goal is to export this 3D diagramm to svg -> I will have to m开发者_如何学Pythonake a projection as svg is not (yet) able to handle 3D.

So my input is a 3D diagramm with x,y,z coordinates and the output is a 2D view reduced to x,y coordinates.

Does anyone know a (preferrable small) java lib like this one for javascript?

The projection might be just point3d to point2d. That is all I really need.

Thank you!


If all you need is something simple then I might say just write it yourself. If you don't need to move the camera you can assume a lot of the calculations zero out, and you can just do the following to get the 2d coordinate for any 3d point:

rect2d.x = rect3d.x / rect3d.z;
rect2d.y = rect3d.y / rect3d.z;

Doing that you can just simple take all of the 3d points that make up your polygon, and use the 2d points as your SVG primitive. The tricky part you're going to have to deal with is hidden surface removal, but that's not too hard. Shading is going to be your real problem, but maybe you can play around with gradients to emulate light.


Have a look at JFreeChart. Have a look at Batik for saving it to SVG

0

精彩评论

暂无评论...
验证码 换一张
取 消