i need to draw a graph like this, the input is an adjacency matrix and the output is the graph in a window, the way of another color is the way with less weight but the most importan for me is to learn to draw a simple graph. Thank you
English is not my language sorry, maybe I did not express myself well
I found a library in python to draw a graph easily, it is called networkx and matplotlib
Related
I'm working on a visualization project. From the data I have calculated the X, Y, and Z coordinates for a large set of points. Using Processing it was very simple to draw this out with lines and dots.
From the top it looks like this:
And from a side angle you can see how it occupies 3D space
The part I'm struggling with is turning this into polygons. I need the end result to be something I can export as a .obj file, and then later open in Blender or similar 3D modelling programs.
The two main issues are that these points are not on a grid, but are instead organized in a circle based on radian angles, and that the triangle structure isn't all that simple.
I tried drawing out my own polygons (it's kinda sorta working), but I'm getting to the point where the maths are getting a bit too complex to handle and my code is bloated with arrays, if statements, and for loops...
Surely there must be a better way? Are there any plugins maybe that would help me with this task? Or some techniques I should take a look at?
Processing has screenX() and screenY() functions that take a 3D point and return a 2D point. That sounds like pretty much exactly what you're looking for. Please see the reference for more info.
Hi I am trying to create simple 2d graphic editor. I need some library which will create shape from given points(draw lines between these points) and then user can move this shape with mouse or scale this shape with mouse. I need points, because I have Oracle Jgeometry shape saved in database and I need to visualize it. Could you please help me?
I found jGraph but I don't know, how to create shape from points, or get these points from shape
Instead of reinventing the wheel I would suggest using svg. There is a pretty nice implementation from Apache: https://xmlgraphics.apache.org/batik/
You could generate svg from your data (which is pretty easy) and pass it on to batik to show in a component or you can use their bindings to Java2D to draw.
As a bonus you can use existing tools like Inkscape to edit you drawings further.
There are existing projects which use this to do simmilar things like you want: https://xmlgraphics.apache.org/batik/uses.html
i want to draw an automata with edges and circulaire states, something like this http://pop-art.inrialpes.fr/~girault/Cours/Automates/td5.html, have u an example for that
JGraph is a library you can use that is native to Java and fairly easy to use, or you can generate a .dot file and let GraphViz take care of it for you.
If you dont want to carry for things like representing the graph in a correct way such you try to not cross the lines, or to not have two or more nodes in the same position then i suggest you to use grail graph library so you can see the graph using yed works (I can provide you an example of it just write the regular expression you in comment), or if you want to draw the graph by yourself then you probably is good to learn about Layered graph drawing :
http://en.wikipedia.org/wiki/Layered_graph_drawing
and Coffman Graham algorithm
http://en.wikipedia.org/wiki/Coffman%E2%80%93Graham_algorithm
I'm looking for a graphic library that allow me to plot a pixel point in a specific color with the purpose of draw a fractal (mandelbrot set). I've read the basic math behind fractal and I understand it, the algorithm is not difficult.
But I don't know what graphic library could I use, I don't need anything sofisticated and complex, just print a pixel set with colors. What do you suggest me? Cairo? OpenGl?.
Note: I only have experience with pygtk. I was reading the Java API and found the the fillRect method and BufferedImages but it seem a little complicate.
Thanks ;)
Unless you want to compute 3D fractals (in which case a library like JOGL Java OpenGL can help), a simple java.awt.Graphics.setColor( java.awt.Color aColor) is enough.
(as show in this program).
In other word, the default awt library in Java should be up to the task: see "Graphics: setColor(Color c)".
I have implemented both mandelbrot and the flame fractal algorithm in native java (no openGL).
The most efficient way is to just store color in an int array or similar,
and then save it as an image file (png or jpg). It is much quicker than using Graphics.
I'm new to opengl-es and I wonder how people are able to draw these much detailed OpenGL ES graphics, e.g. on Android OS. It's already hard to draw a single squre, because it's composed of triangles due to the reason that OpenGL ES obviously cannot draw anything else than triangles.
I thought about this approach:
Drawing and rendering an object in Blender.
Export it somehow as array of vertices and an array of colors
Copy this array of vertices into the Java code
Run the code
Or are there approaches to solve such problems in a better way? I do not think that people just "draw" their graphics as array of vertices in the code. I'm sure they draw them anywhere else and import it into the code.
If there is such a solution with Blender, I would be pleased to know how this is solved.
Regards.
You can save your model from Blender e.g. as Wavefront OBJ file. In Blender, you can also select to triangulate the model for you, which will result in a list of just triangles, ready for drawing.
OBJ is a very simple format, it just lists in ASCII the position of each vertex and then which vertices belong to each triangle. Either convert the OBJ to a format specific to your application (e.g. binary buffer you can directly load to OpenGL) or find yourself one of the many OBJ loaders, or write your own reader.
There are a lot of other common formats available, you should take a look at them and see if there is an importer for Android available.
What I've found is that you can Load 3D models with min3D directly to your program using:
min3d
I hope this helps.