I try to draw a spline using openGL and Java.
What I have now is just a set of points. What I want is a spline, which goes through each of these points.
Is there a special function in openGL for accomplish it?
Is there a special function in openGL for accomplish it?
No. And later versions of OpenGL (v3 and later) did focus on deprecating and removing anything specialized. You can write a combination of tesselation, geometry and vertex shaders that generate a tesselated bezier spline from a set of input points. But you'll have to write those shaders yourself.
Related
So I have some irregularly spaced data that I want to interpolate onto a regular grid. (I want to do exactly this but in Java) Here's a picture:
Basically I have the x and y coordinates of each point and a z value associated with each point and I want to interpolate between them and fill in the center of my image.
What is the best way to do this using Java? Is there a built in 2D interpolation library I can use or should I try a "roll my own" approach?
This post and this one also seem to be trying to do about what I am but their answers don't quite apply.
Someone else with the same problem but no solution.
Note: I am using JavaFX-2 so if I could somehow use their Interpolator class that'd be great.
.
.
EDIT:
If anyone stumbles upon this and wants to know what I ended up using, it was a Delaunay Triangulation implementation from BGU:
Main Site
Code API
If linear interpolation is sufficient, I suggest you to use a 3d mesh with Gouraud Shading for drawing:
Convert the 2d point cloud to a mesh (you can google for existing algorithms)
Mapping the z value of each point to the vertex' color
Using Gouraud Shading to enable linear interpolation between the vertex colors
Creating a camera on top to the mesh and using a othonormal projection (to avoid perspective)
You say that you can use JavaFX. JavaFX supports 3d scenes and you can build your own meshes. But looking into the JavaDoc of TriangleMesh, I can't find any method to set the vertex color I found only a method to set the (x,y,z) and (u,v) (texture coordinates) coordinates.
I want to detect a circle, rectangle shaped object in an image and read the information from that object. Is there any api in java which will be helpful to me?
Ex: Detect a round shaped coin in a white background and obtain information about that that coin like ( value of a coin, etc.)
Thanks.
Here's an answer to a similar question for C++.
For Java, you can use the OpenCV wrappers. However, once you understand the essence of the approach you should be able to solve your problem using whichever framework is available.
Circles are perfect targets for the Hough transform. Check this out Detect circles with HT and OpenCV
Rectangles are a bit harder since the Hough Transform is not rotation invariant. You can go into edge detection and fast fitting (Fast line and rectangle detection by clustering and grouping)
I am looking to make an arm where each joint can be controlled given an input. For example, I would receive a location each millisecond and I would need each joint to move to that new location. This is going to be used to simulate motion capture. Are there any good tutorials about how to do this. I am programming this on an atom board with limited support for openGL. I tried using C++ G3D but it seems to be too complicated for the graphics card. There were some glitches when rendering. Would a more basic OpenGL only approach be better? Are there models for arms that have pivot points built into them?
G3D itself uses OpenGL as a rasterizer backend, so I doubt that would make any differency. After all OpenGL is just a drawing API and doesn't maintain a scene. You send it commands to draw points, lines and triangles and it executes them. It's really nothing more. You need to implement scene management to do anything usefull with OpenGL, and controlling a figure is already a quite complex task.
I am making an app where I need to draw a sine wave between two given points. I have Google'd, and Google'd, and I haven't found anything that I have found suitable.
Is there an efficient way in android to use some pre defined points to draw a smooth wave like form?
You can use the android.graphics.Path class to construct a set of quadratic or cubic Bézier spline curves between your set of control points.
I want to detect a circle, rectangle shaped object in an image and read the information from that object. Is there any api in java which will be helpful to me?
Ex: Detect a round shaped coin in a white background and obtain information about that that coin like ( value of a coin, etc.)
Thanks.
Here's an answer to a similar question for C++.
For Java, you can use the OpenCV wrappers. However, once you understand the essence of the approach you should be able to solve your problem using whichever framework is available.
Circles are perfect targets for the Hough transform. Check this out Detect circles with HT and OpenCV
Rectangles are a bit harder since the Hough Transform is not rotation invariant. You can go into edge detection and fast fitting (Fast line and rectangle detection by clustering and grouping)