FAQ Database Discussion Community


SVG simple animations

html,css,animation,svg,polygon
I'm trying to learn how to use SVG elements so I've made simple icon/logo in Illustrator. Then I've used this SVG icon in my example: @import url(http://fonts.googleapis.com/css?family=Lato); body { background-color: #2F2724; font-family: lato, sans-serif; } .main { text-align: center; } .letterS { fill: #fff; font-size: 180px; text-shadow: 0px 2px 2px...

c# wpf polygon to bitmap not displaying anything

c#,wpf,bitmap,polygon
Sorry if you think this question was already answered, I did look everywhere trying to find out how come when I do this, it is not displaying anything. This is all my code: Polygon hexagon = new Polygon(); PointCollection pc = new PointCollection(); double side = 25; double xOffset =...

Java/libGDX - how to check Polygon collision with Rectangle or Circle

java,libgdx,collision-detection,polygon
I'm new to libGDX and from what I can tell the Intersector class has overlap methods for Rectangle/Rectangle, Circle/Circle, Circle/Rectangle, and Polygon/Polygon, but for some reason it doesn't seem to have any methods for checking Polygon/Rectangle or Polygon/Circle. Is there a recommended way to check for collision between polygon and...

Sort polygon's points for drawing

algorithm,sorting,math,polygon
I have a matrix (0 means nothing, 1 means terrain) that represents a level in my game. The matrix corresponds to a grid that my screen is broken up into, and indicates where my terrain goes. My terrain is actually composed of 4 points in the corners of each block...

Python, generating a ten Point polygon

python,windows,polygon,points
I am attempting to generate a polygon with Points. I am using Python 3.4 on Windows 7. I would like to know where my error is in this line of code. leftEar = Polygon(Point(158,218), Point(160,208), Point(166,197), Point(174,186), Point(183,180), Point(190,179), Point(195,184), Point(197,191), Point(193,199), Point(184,210)) leftEar.setFill("blue") leftEar.setOutline("black") LeftEar.draw(win) These points were all...

Filling a polygon with maximum number of grid squares

algorithm,2d,polygon,rectangles
I've got a 2d polygon. I'm placing it on a square grid and marking the squares that are completely inside the shape. I need to find the placement that maximizes number of marked squares. The polygon orientation is fixed, it can be only translated. How can I do so?...

How to display polygons that are within a specific range (circle) using Leaflet

mongodb,leaflet,polygon,openstreetmap,circle
I am trying find a solution on how to display polygons that are only within a specific range, a circle with radius using leaflet. Polygons screenshots Before, I have ask for help regarding on the display of points within a specific range but this time, since a polygon have many...

Incorrectly drawn octagon (random) - NEW TEST ADDED

python,opengl,graphics,polygon,pyglet
I'm trying to draw an octagon with Python 3.4 and Pyglet 1.2, which uses OpenGL. My code seems to be correct but the drawing sometimes has additional triangle of random color (white or black most of the time) at random position (0, 0 (bottom left) corner most of the time)...

Google maps v3 decode polygon(s) from MySQL database

mysql,xml,google-maps,polygon,decode
I would like to draw one or more polygons which are saved encoded in the MySQL database. I've based my code on the known bermudatriangle script example. The XML from "polygon_xml.php" is OK. For now, there's only 1 encoded coordinate in the database. At: //alert1(decodedPolygon); the coordinates are shown, but...

Create a polygon from point cloud

java,polygon
I have a point(x,y) array and i want to use it to see if a point (x2,y2) is in the polygon created my the point cloud. How can I check it? I found http://www.pointclouds.org/documentation/tutorials/hull_2d.php but I really don't know how to do he same with Java. The only real goal...

How to create a Polygon given its Point vertices?

python,polygon,shapely
I want to create a polygon from shapely points. p1 = Point(0,0) p2 = Point(1,0) p3 = Point(1,1) p4 = Point(0,1) pointList = [p1,p2,p3,p4,p1] poly = Polygon(pointList) gives me an type error TypeError: object of type 'Point' has no len() How to create a Polygon from shapely Point objects?...

SVG triangle - why is it so small?

svg,geometry,polygon
I have created two simple SVG files for play and pause icons: Play: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5" height="5"> <polygon points="0,0 0,4 4,2" style="fill: red;" /> </svg> Pause: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5" height="5"> <rect x="0" y="0" width="2" height="5" style="fill: red;" /> <rect x="3" y="0" width="2" height="5" style="fill: red;" />...

Create polygon of non-transparent parts of image

java,arrays,image,polygon
What I am trying to achieve is getting a mask of an image, converting it into an Array with the dimensions (image.getWidth(), image.getHeight()), then getting all the pixels and seeing if they have an alpha value of 0. IF they do, then: add value 1 for the x, y co-ordinate...

C# WPF -> How to get the coordinates from a stretched(uniform) polygon on a grid

c#,wpf,coordinates,polygon
I searched a lot to find a solution for my problem. Couldn't find anything. This is what I do: I render a polygon via point array on a grid. The polygon autoresizing itself to match the grids size(uniform). I get the new stretched coordinates with the following lines and create...

How to avoid one dimensional arrays from being reinitialized when paint() method is called

java,swing,user-interface,graphics,polygon
I am creating a program that draws a polygon and fills it. It then displays buttons so the user can move the polygon up, down, left, or right. Right now I am having an issue when I call the repaint() method. In the paint() method I create a new instance...

Drawing a polygpn in JavaFx

canvas,javafx,polygon,fxml
Im new to javafx so please don't be harsh on me :) Im trying to draw a polygon on a canvas using predefined set of points but i can't seem to understand how to go about doing it. Ive looked around for tutorials but they didn't seem to help. Any...

How to plot points outside certain polygon area in MATLAB

matlab,plot,polygon
I have been looking around for a method to plot points outside a polygon's area(hexagon in my case). Here's the scenario that I want to achieve, I have a small hexagon located inside a big hexagon. The picture is as follows: In the picture, I created a small hexagon (whom...

Cut polygon algorithm

algorithm,polygon,clipping
i'm trying to solve a problem where a polygon object that cross the min/max Y points have to be splited to parts thus new rectangle/polygon object will be created Here the red marked range is my x1,y1 and x2,y2 points and everything that is inside of it must be removed,...

Java 2D Polygon - Polygon Collision Detection

java,math,collision-detection,polygon
Recently I have been using the Polygon class to create asteroids as well as bullets and a spaceship. I am currently trying to create the collision detection for the program however it appears that the collision detection only works around 1/5 of the time (no pattern appears as to why...

How to make a Plus sign in XAML in WPF?

wpf,xaml,polygon
How to make a Plus Sign in WPF using Polygon? <Polygon Points="?,? ?,? ?,? ?,?" Fill="Green"></Polygon> ...

Scale animation on polygon

jquery,svg,polygon
I have a <polygon> that i want to do an scale effect on mouseover, returning to the original size on mouse out, and with a smooth animation, any idea of how can i do that? Y tried with jQuery, changing the class of the <polygon> but nothing works The last...

How to clear a JFrame in Netbeans after a polygon has been drawn

java,netbeans,jframe,polygon,repaint
I made this program that draws a polygon in a JFrame and then fills it. I have recently changed it so that I have buttons that control movement of the polygon. The movement works besides one issue: when I press a button to move the polygon a direction, a new...

Calculate the area of a polygon drawn on google maps in an Android application

android,google-maps,google-maps-android-api-2,polygon
I would like to calculate the are of a polygon drawn in a map fragment for a college project. This is how I draw my polygon. @Override public void onMapClick(LatLng point) { //tvLocInfo.setText("New marker [email protected]" + point.toString()); map.addMarker(new MarkerOptions().position(point).draggable(true).title(point.toString())); markerClicked = false; } @Override public void onMapLongClick(LatLng point) { //tvLocInfo.setText("New...

Python - Getting attributes from Line contained in a MultiLineString shapefile that intersects a Polygon

python,polygon,shapely,multilinestring
I have 2 shapefiles, 1 containing a lot of lines that make up a road network, and another with many GPS points. So far I've managed to open both shapefiles and do an intersection() using Shapely and Fiona, using the code found here - http://gis.stackexchange.com/a/128210/52590 Here's a copy of my...

How to transition from a triangle to a circle

html,css,css3,css-transitions,polygon
I have some images masked with clip-paths in CSS to show equilateral triangles. I want them to expand and become circles on hover. Here's my CSS: .tri-Up { -webkit-clip-path: polygon(50% 0, 0 100%, 100% 100%); clip-path: polygon(50% 0, 0 100%, 100% 100%); transition: 2s; } a:hover .tri-Up, a:focus .tri-Up {...

Polygon Clipping not working when using Sutherland-Hodgman Algorithm

java,algorithm,netbeans,polygon,clipping
I am writing a program that creates a polygon that is shaped like a fish and fills it with green. There are buttons to move the this fish around inside of a window. I want to have only the parts of the fish that are inside of the window to...

Filling in polygon with my polygon fill algorithm give an out of bounds error

java,polygon,indexoutofboundsexception,fill
I am creating a program that takes draws a polygon and then fills the polygon with green. I am currently having an issue with the algorithm I have written as it only fills the top half of the polygon and then I get an IndexOutOfBounds error. Here is the code...

How to create a body with Polygon and Rectangle attached together in Libgdx

java,libgdx,polygon
I am a newbie in Libgdx. I am working on detecting collisions for two bodies. Have created two bodies using "polygonshape" but unfortunately there isn't any method to detect collision among "PolygonShapes" but for "rectangles" .So I came up with an idea of attaching the rectangle at the front of...

How to handle loops when going i-1

c#,list,loops,polygon,triangulation
I have a general question about looping in c#, especially when using lists. I want to implement a simple polygon ear-slicing algorithm. Here is the algorithm: (Source: http://www.diva-portal.org/smash/get/diva2:330344/FULLTEXT02 , Page 6) I already implemented finding the ear tips. But there is the problem that I have to access i-1 or...

How to draw a polygon with androidPlot library?

android,polygon,androidplot
I'm trying to draw a polygon with AndroidPlot library. I'm successfully drawing the four points, but it draws only 3 sides of the polygon. (it's not closing the polygon) The polygon should be filled. How can I achieve this? Thanks! Edit: I'm firstly drawing a point and then the polygon,...

How to efficiently test whether an arbitrary polygon intersects with a square?

algorithm,math,geometry,polygon,intersection
The polygon may or may not be convex. We can assume that the edges of the square align with X and Y axis. Calculating the intersection [A simple algorithm for polygon intersection]1 is an over-kill, as I only need to know whether they intersect (Yes or No)....

svg polygon top on the image

svg,footer,polygon
I need add image in the footer and on the image draw polygon, i try use z-index values but cannot get it on the top. My code example: body { display: flex; flex-direction: column; height: 100vh; } footer { position: fixed; top: 180px; bottom: 0; width: 100%; } footer img[usemap]...

Auto-completing “Create Polygon Tool” Maya

python,python-2.7,polygon,maya,pymel
I'm trying to figure out a way to create an auto-completing "Create Polygon Tool" in Maya, in Python. It's so when you build geometry, it will select the previous geometry, and the current one you made, and run a line of commands. I've run into a snag, though, in which...

Draw triangle with rounded corner

java,swing,polygon,rounded-corners
I would like to draw a triangle whose vertices are a bit smoothed in Java Swing. I learnt how to draw a triangle with these lines of code Polygon p=new Polygon (vertice_x, vertices_y, number_of_vertices); g.drawPolygon(p); but I've found nothing about rounded corners. I read there is a method in Graphics2D...

Merging features to one just gives back a feature with braking lines within

merge,polygon,qgis,feature-selection
I have a similar question to this one: "snapping" polygons together I have drawn let's say 3 areas. The 1. is overlapping with the 2. and the 2. is overlapping with the 3. I made sure that I was using the snapping tool and the outer lines are matching each...

Python, Shapely: what is the difference between Polygon.contains and Polygon.within?

python,polygon,shapely
The Docstring says: Polygon.contains Returns True if the geometry contains the other, else False Polygon.within Returns True if geometry is within the other, else False How are they different?...

Java, generate random polygons in desired locations

java,math,polygon
I need to generate random polygons to use as asteroids for my game. I've been experimenting, trying to figure out how to do this but I keep getting stuck finding the x and y positions. To start, I create an angle and a length for each point of the polygon....

Is MySQL Polygon datatype better than storing polygon as a JSON object (text)?

mysql,json,polygon
I retrieve my polygons from the UI in this specific format: [0] => [ [0] => [X, Y], [1] => [X2, Y2], [2] => [X3, Y3], [3] => [X, Y] ], [1] => [ [0] => ... ] From my understanding, MySQL Polygon datatype hold data this way : Polygon((X...

Count number of buffers that touch a (polygon) feature

buffer,polygon,geospatial,spatial,arcgis
I'm facing the following task in ArcGIS - I'm using ArcMap 10.2 I have a polygon shapefile with counties of (say) a state in US. From this shapefile, I create a layer which marks all counties in which there is at least 1 city of more than 50000 inhabitants (I...

creating polygons based on intersection

java,algorithm,polygon,intersection
Say I have two polygons, A and B. Polygon A has points at (0,0), (0, 5), and (5, 0) Polygon B has points at (-2, 2), (5, 5), and (5, 2) My goal is to split this in to 3 different polygons Polygon 1 would be Polygon A - where...

Calculate vertices for n sided regular polygon

ios,cocoa-touch,swift,geometry,polygon
I have tried to follow this answer It works fine for creating the polygons, however I can see that it doesn't reach the edges of the containing rectangle. The following gif shows what I mean. Especially for the 5 sided polygon it is clear that it doesn't "span" the rectangle...

Find inside coordinates of polygon in tile based map

java,awt,coordinates,polygon,java-2d
If I have all of the outer edges of polygons in a list how would I go about finding the inside coordinates?? To make matters simple I drew the following image to represent the problem: I need to find the inside of 'buildings' in a tilebased game. outside walls -...

Find intersection of polygon and order by line

c#,order,geometry,polygon,intersection
I was wondering if there is a method to order intersection points in a list based on the direction of the intersected line. Here is a picture to get the idea: The red numbers are the polygon lines which exist in a List. Then I have another List with lines...

Draw a rectangle google.maps.Polygon given its center point and dimensions

google-maps,google-maps-api-3,polygon
I am working on a PHP script which takes XML input, parses it and then displays (eventually rotated) rectangle and ellipses areas. Because area can be rotated, I have to use google.maps.Polygon and not Rectangle. To handle rotation I hope to use the google-maps-polygon-rotate library (that part comes later). My...

Polygon Triangle with Curved Hypotenuse

c#,wpf,xaml,polygon
I can create a polygon with the following XAML: <Polygon Grid.Row="1" Grid.Column="1" Fill="{StaticResource GreenBrush}" Points="0,1 1,1 1,0" Stretch="Fill" /> This results in a right angled triangle with a straight hypotenuse.However I would like a curved hypotenuse. Is this possible using a Polygon? if not how might I accomplish the goal?...

find polygon boundaries for a labelmap

matlab,svg,polygon
I have a labelmap matrix describing an image. As shown in the image, it is visualized in Matlab by imshow(im,[]) How can I extract polygon boundaries describing each label region? For all labels, I would have a set of polygon boundaries. What is the most efficient way of extract...

Spatial data in R: plot decision regions of multi-class SVM

r,polygon,spatial
I've got a data.frame with x and y columns, and a class column that gives the classification of each point under an existing multi-class SVM model. Here's some example code: library(rgdal) library(rgeos) library(e1071) # for svm() library(sp) library(raster) library(maptools) library(plyr) ## Create a mask of the data region, as a...

How to draw spokes from the center of a polygon to it's boundary using R

r,polygon
Suppose we have a polygon with five vertices. The two coordinates of the vertices are- >x=c(1,4,6,3,-2) >y=c(1,1,5,9,4) We define the centre of the polygon as the point (mean(x),mean(y)). I am struggling to draw spokes from the centre of the polygon to the boundary of the polygon such that the spokes...

How do I catch a click event on a polygon in HighCharts without having the tooltip popping up

events,highcharts,polygon
I have a chart <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts-more.js"></script> <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div> $(function () { $('#container').highcharts({ series: [{ type: 'polygon', data: [[153, 42], [149, 46], [166, 45]], color: '#ff0000', enableMouseTracking: true, events: { click: function(event) { alert("I am clicked"); } } }] });...

CSS Container Wrap shaped Polygons

css3,polygon,css-shapes
How can I build the white/green Container (shaped Polygons) with CSS / CSS3 ? ...