AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Question QUESTION: I would like to write 2D contour plot routine in vb.net
Lets say you have four values of a function f(x,y) at four corners of a square. How do you fill the square to represent variation of f(x,y) in vb.net?
ANSWER: can you send an image of what you want to plot with sample values on each corner?
---------- FOLLOW-UP ----------
QUESTION: I am not interested in one particular image. To put it more generally, I have an array of values f(i,j) over a regular grid. I would like to draw filled contour plots.
The above link will take you to the generic VB.net 2D drawing API.
After finding the API that suits your need you can come back to me and we can discuss it in greater detail.
Regards,
Riz
---------- FOLLOW-UP ----------
QUESTION: I have already coded some "drawing" using GDI+ e.g using code such as
e.Graphics.DrawLines(bluePen, coor_init_pts)
I have two problems -
1. I do not know a good way to "fill" colors according to contour variable
2. I have drawn this on a panel and I do not know how to generate images (like jpg) from drawing on a panel.
I have tried googling but I do not understand it well adn I didn't find a "complete" code. Take a look at the following outline
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
...
e.Graphics.DrawLine(BlackPen, MeshOrigin(1), yg_min + 10, MeshOrigin(1), yg_max - 10)
...
end sub
Now after I have done such drawing, I want to do two things-
1. Save image of my drawing
2. Draw contour line as per contour variable value at "mesh points" - defined within the code - think of pair of integers (i,j) and values f(i,j)
3. Fill contours with colors depending on contour value.
I can't even do 1, and would like to know about 2 and 3 as well.
Answer 1. use img = new Image: g = new Graphics.FromImage(img): 'Do funky graphics stuff here: img.Save(...).
2. Drawing lines doesn't create a closed region. I ask you to investigate DrawRegion or DrawPolygon to create and merge complex Regions/Meshes then it becomes really easy to fill them as well.