Tadaa! This is my first attempt at writing in Python, trying to solve a good question posed [here](http://www.daniweb.com/software-development/python/threads/32007/projects-for-the-beginner/17#post2016892) #----------------------------------------------------------------------------------------------- # # Python 2.7 # # Calculating area and radius of polygons with known number of sides and the length of this side # Adapted formulas used from this site: http://www.mathwords.com/a/area_regular_polygon.htm # DM 17/09/2013 first attempt to produce a plusminus decent Python script #----------------------------------------------------------------------------------------------- import math from string import Template def Calculate_PolygonArea (NumberofSides, SideLength ): return ( NumberofSides * SideLength ** 2 ) / (4 * math.tan( math.pi / NumberofSides )) def Calculate_PolygonRadius( NumberofSides, SideLength ): return SideLength / (2 * …

Member Avatar
Member Avatar
+1 forum 7

If I am given the exact coordinates of three vertices in image-space (as in, the numbers are not integers, but can be rounded to find their location on the screen), how can I determine which pixels are inside the triangle and should be colored? If you look at the diagram below it might clarify what I'm trying to do http://oi47.tinypic.com/eaktwi.jpg As you can see, the pixels which are mostly within the triangle are filled green. How can I do this in code?

Member Avatar
Member Avatar
+0 forum 4

I have created a polygon (6 points). Lets call this one, outside polygon. inside the outside polygon I created smaller polygons. I want to flip all of it vertically. I know the points of the outside polygon and I have an ArrayList for the inner polygons. I was able to flip the outside polygon. but how do I flipped the inner polygons keeping their relative positions in the new one? I know the center of the outside polygon and the flipped version. Imagine that you are playing cards (the cards are shaped as polygons of 6 points) with and you …

Member Avatar
Member Avatar
+0 forum 6

Hi Frendz, I have a set of polygon points on google map. I need to find whether the given input point is lying inside of the polygon or not? If anybody found articles related this please guide me. And also i need the same with poly line.

Member Avatar
Member Avatar
+0 forum 8

Hi again and thanks in advance ! Last question ! I have to create a class called polygon (not normal) that has in private the number of sides and the length of each side and in public that has 2 constructors (the one has as variables the number and each length (how is that possible), getlength (perimeter) , setpolygon , getedge (of a k side) . Also then i have to make a subclass called rectangle that has constructor with length,height getlength again ,getarea ... What does rectangle inherits from polygon ? Here's the code of the polygon class but …

Member Avatar
Member Avatar
+1 forum 2

[I]Create a program called, Containment, that accepts three command line arguments, a file that contains a list of shapes, and a pair of numbers the specifies the (x,y) coordinates for a point. The program should print out the list of shapes, and a true/false value that indicates if the point is contained in the shape. The shapes file contains one shape per line. An example of the file with all the possible shapes is: rect "r1" 20.0 5.0 50.0 25.0 ellipse "e1" 0.0 0.0 5.0 3.0 polygon "p1" 20.0 0.0 40.0 0.0 40.0 20.0 20.0 20.0 There are three possible …

Member Avatar
Member Avatar
+0 forum 8

I'm using Swing's GeneralPath to create complex shapes and fill them. Usually I do this, and it creates a nice hexagon for me: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); g2.draw(path);[/CODE] Suppose I wanted to create a donut-shaped GeneralPath, and do this: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); path.moveTo(110, 110); path.lineTo(125, 120); path.lineTo(110, 120); path.lineTo(110, 110); path.closePath();[/CODE] Draw this and you'll get the same hexagon with a closed triangle in the middle (a pretty bad donut, yeah). That's all fine, but when I …

Member Avatar
Member Avatar
+0 forum 1

Hello all, I'm trying to inherit a "CarPanel" I created using arrays to draw various shapes in order to make a car. Now I am trying to essentially create a subclass that inherits that class, but add a Timer Action to move the car across the screen. I got it to work for my non-array using shapes, but the shapes that use the arrays are not working. Here is my driver: [code] package drawcar; import javax.swing.*; public class DrawCar { public static void main(String[] args) { JFrame frame = new JFrame("Car"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final MovingCar panel = new MovingCar(); frame.getContentPane().add(panel); frame.pack(); …

Member Avatar
Member Avatar
+0 forum 12

I have this problem: [CODE]struct Position { float x; float y; float z; }; bool CheckCollision(Position *vertices, int numvertices, Position start, Position end) { //return true if there was NOT a collision with the polygon defined by the vertices and the vector defined by the two positions. }[/CODE] I dont even know where to begin, I thought of stepping through the vector from start to end in small increments, but that would be slow and might pass right through the polygon sans interference. Any hints?

Member Avatar
Member Avatar
+0 forum 7

Dear all! I have a final year project on Google maps. The aim of the project create a map for a farm land in a city and to read the data to be displayed on the maps from a database. But the thing is I need someone who has done something in relation with these to give me an hint on how to go about it. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 12

How to add control for marking area using points,lines and polygons on google map and how to store that area in mysql db? Becoz i need to give alert message when my vehicle cross that area in my vehicle tracking system.

Member Avatar
Member Avatar
+0 forum 1

The End.