shapes

Area of a irregular shape

I have set of points which lies on the image. These set of points form a irregular closed shape. I need to find the area of this shape. Does any body which is the normal algorithm used for calculating the area ? Or is there any support available in libraries such as boost? I am using C++. ...

How to design shape class

I want to design shape class. I need to distinguish several different shapes: -Point -Line -Triangle -Circle -Polygons The main purpose of this class is to calculate distance between two shapes. I've all methods for calculating those distances, but I want to have a single method that can be used, it should looks like this:...

Can we move shape (Diamond) in C#

I want to move a Diamond Shape in the form(for example 2 pixels every 200ms) horizantally. I used the following code in From_Paint Event. private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Point p1 = new Point(5,0); Point p2 = new Point(10, 5); Point p3 = new Point(5, 10); Point p4 =...

C#- move a shape to a point which is half way from the top of the form

Hello all, Here I have to create a diamond using drawlines method and make it move horizontally along a path that is half way from the top of the form. I created a diamond and it is moving horizontally, but i want it to start moving from a position which is half way from the top of the form. This is the code to create a diamond, ...

How to draw 'biohazard' with swing

I'm practicing my swing abilities for the upcoming test, and fried gave me idea to draw biohazard sign like this : I could draw the circles with Elipse2D, but then I somehow need to cut those 3 triangles. Any ideas how I can do that ? ...

Drawing star shapes with variable parameters

Hi. I have task to write program allowing users to draw stars, which can differ in size and amount of arms. When I was dealing with basic stars I was doing it with GeneralPath and tables of points : int xPoints[] = { 55, 67, 109, 73, 83, 55, 27, 37, 1, 43 }; int yPoints[] = { 0, 36, 36, 54, 96, 72, 96, 54, 36, 36 }; Graph...

shortest path search in a map represented as 2d shapes

Hi, I have a small library of a few shortest path search algorithms. They were developed for simple undirected graphs (the normal representation - vertices and edges). Now I'd like to somehow apply them on a bit different scenario - where the maps are represented as 2-dimensional shapes, connected by shared edges (edges of the polygons,...

Geometric Shape Recognition & Find Extreme Points in C#

Hi, Can anyone tell me how to recognize geometric shape using C#? I have geometric shapes like triangle, hexagon, pentagon, diamond, square,parallelogram, rectangle, etc. I have drawn all these shapes using mspaint. i have one picture box, using opendialog i am selecting any of the geometric shapes, into picturebox. I want to identify...

Java2D: Fill a convex rounded polygon (QuadCurves)

Hi, If I have a QuadCurve like this (+ = node): + + \ ./ +--⁻⁻ And I fill it in Java 2D the result is something like this: (x = colored) +xxxxxxxxx+ \xxxxxx./ +--⁻⁻ But I want to color the other side: + + x\ ./x xxx +--⁻⁻xx xxxxxxxxxxx This succeeds by drawing a rectangle around the curve in th...

Multiline Text as the button label - WIndows Forms

Basically, i am creating a button in Oval shape. But my button label is too long to display in one line. So i wanted to split in to multiple lines. So the Oval button looks good. My Problem is, How to enable word wrap on a Button? Any suggestions? ...

How do I draw an ellipse with arbitrary orientation pixel by pixel?

Hi, I have to draw an ellipse of arbitrary size and orientation pixel by pixel. It seems pretty easy to draw an ellipse whose major and minor axes align with the x and y axes, but rotating the ellipse by an arbitrary angle seems trickier. Initially I though it might work to draw the unrotated ellipse and apply a rotation matrix to eac...

Merge shapes and draw border around final shape

I can't post images yet: http://i.imgur.com/7Kci5.jpg Using Actionscript 3 I'm drawing multiple Shapes onto a MovieClip [top drawing]. The end result I need is the bottom drawing. I originally thought it would be simple to just merge the shapes and then find a way to draw a border around the end result but I can't seem to find any way o...

Collision detecting custom sketched shape, represented as list of points

I have a set of points, drawn by the user. They will be drawing around some objects. I need to somehow turn this set of points into a shape, so I can find the area to detect collisions. An image will clarify: . The best idea I have had so far involves iterating over every pixel determining if it is 'inside' or 'outside' the shape, b...

box2d angle rotation in uiimageview for compund shapes

I want to apply an rotation to an uiimageview for shapes like "U" and "T" using compund objects and box2D, because "U" shapes are concave polygons so i can't do it using b2polygondef only. Here it is the method to make an "u" shape box when the user click on the screen // map from the world to the screen and screen to the world #define...

Is there a way to re-use Styles for Shapes in Silverlight 4?

I'm trying to create a resource Style for a Path (Shape), however, when creating several Paths that use the Style, only the first one is rendered. //In resources xaml <clr:String x:Key="path">M 50,50 L 35,15 A 8,10 0 0 1 65,15z</clr:String> <Style TargetType="Path" x:Key="pathStyle"> <Setter Property="Stroke" Value="Black"> </Style...

Sorting ArrayList of shapes

I have an ArrayList of MCommand objects (cmdList) and I want to sort it so that shapes with closest points are next to each other in the ArrayList. For example, say I have three lines in the ArrayList: line(xs, ys, zs, xe, ye, ze) cmdList[0] = line1(1.3, 2.5, 3, 4, 5, 6) cmdList[1] = line2(1, 5, 6.77, 7, 8, 2) cmdList[2] = line3(1, 6,...

How can I set different stroke properties to in a path object in WPF

I have a path shape that I would like to combine lines that have different line thicknesses? The StrokeThickness property is set on the Path object so I cannot change it for different lines. This same issue would arise if I wanted to change my line color. The reason I want to do this is so that I can draw an arrowhead. Charles Petzold a...

How To Convert a Bitmap to a Collection of Paths in WPF (in code not XAML)

I have an occupancy grid that has 3 states - Occupied, Free, Unknown. Occupancy grid is a simple 2 dimensional array of states. The grid represents a floor plan where Occupied=Wall, Free=Open Floor, Unknown=what's behind the wall or not mapped. This grid is say 800x800 wide with each cell representing 5cm of the real world. I want to...

how to create/draw dynamic shapes in flex 4

hello, Im a new bee in flex , I want to draw different dynamic shapes.. a sample url is given below. Any suggestion would be appreciated.. http://www.onlinelabels.com/maestro-label-design-software.htm ...

Shape glass effect

Hi, I've created a custom toolbar using a gradient inside a shape. It looks very nice, but since we only have the option for 3 colors (startColor, centerColor, endColor) it looks very round. I would like to do a glass effect, which requires a sharp change in color in the middle. Basically I need 4 colors (startColor, justabovecenterC...