polygon

Force chart d3.js inside a triangle

两盒软妹~` 提交于 2019-12-03 16:21:36
I'm studying d3.js force chart and I have a question. Is it possible to make a force chart inside a triangle with some coordinates? Here is my code: var width = 500; var height = 500; //margin var marginLeft = 10; var marginTop = 10; var marginRight = 10; var marginBottom = 10; var margin = { left: marginLeft , top: marginTop, right: marginRight, bottom: marginBottom}; //size of canvas var innerWidth = width - margin.left - margin.right; var innerHeight = height - margin.top - margin.bottom; var radius = 10; var svg = d3.select(".forcechart").append("svg") .attr("width", width) .attr("height",

Computing a polygon that surrounds a multi-point line

隐身守侯 提交于 2019-12-03 14:45:31
I am trying to compute a polygon that surrounds a line connecting multiple points (e.g. a GPX track). The image below shows an example with the track as red line and the desired polygon in blue. As simplification the red points are denoted by x and y - not by latitude/longitude. How do I compute such an environment (light blue polygon) if I only have the list of the three points specifying the path? Partial solutions (e.g. for only two points) or hints about mathematical libraries (in Java) that provide algorithms for such a computation would also bring me one step forward. Further assumptions

How to correct Polygon Ring Orientation using C# Entity Framework 5 DbGeography Spatial Data

谁都会走 提交于 2019-12-03 14:16:32
I'm working with the new Entity-Framework 5 using the Spatial data type DbGeography as part of my model for storing in one instance, a POINT and in another instance a POLYGON. When setting the value of my POLYGON all saves with no error however this is only the case if I draw the Polygon on the map in a clockwise order. If I draw the POLGON in an anti-clockwise direction I get an error the the sql level indicating that the data is an invalid geography type. Now after doing my own research into the problem, it appears to stem from the geography data type being quite strict in terms of a

Get polygon points mysql

十年热恋 提交于 2019-12-03 13:27:38
问题 i have created a table in mysql to store polygon data: CREATE TABLE geom (g GEOMETRY); And i inserted a polygon into it, using the following syntax: INSERT INTO geom (g) VALUES(PolygonFromText('POLYGON(( 9.190586853 45.464518970, 9.190602686 45.463993916, 9.191572471 45.464001929, 9.191613325 45.463884676, 9.192136130 45.463880767, 9.192111509 45.464095594, 9.192427961 45.464117804, 9.192417811 45.464112862, 9.192509035 45.464225851, 9.192493139 45.464371079, 9.192448471 45.464439002, 9

java - merge adiacent rectangles into a polygon

眉间皱痕 提交于 2019-12-03 13:25:21
问题 I have a set of rectangles that have the same width and height and are always adiacent. I know the position of all the vertices, each one having only 4. (because is a square). This image can explain this: If there are any gaps, is ok if the algorithm will 'fill' the gap. I searched a lot, and could not find anything good.. I need an simple algorithm, it doesn't have to be that efficient.. Let's say that we got 7 rectangles like in the second polygon example from the image. Is ok if I first

Avoiding hoizontal lines and crazy shapes when plotting maps in ggplot2

社会主义新天地 提交于 2019-12-03 13:07:36
I want a plot of an area, such as Latin America, using the world shape file from IPUMSI... https://international.ipums.org/international/resources/gis/IPUMSI_world.zip ... I will add some more IPUMS districts later so I really want to use this as my template layer. I having difficulty with the plot when I add limits through coord_map in ggplot2. The initial spatial file looks alright library("ggplot2") library("raster") sd0 <- readShapePoly("./IPUMSI_world.shp") df0 <- fortify(sd0) ggplot(data = df0, mapping = aes(x = long, y = lat, group = group)) + geom_polygon(fill = "black", colour =

Put label in the “center” of an SVG path

孤人 提交于 2019-12-03 11:39:43
问题 I'm trying to draw a label on a polygon of an svg file. The problem I'm facing is to find out roughly the center of this polygon to place the label, as the path's coordinates are in svg format and need to be parsed. Is there an easier way to determine the center of an svg polygon (maybe someone can point out a javascript library or a snippet)? I'm using Raphael javascript library to manipulate the svg, but it doesn't seem to go beyond the standard svg functionality. 回答1: You could try the

Transparency with polygon command

徘徊边缘 提交于 2019-12-03 11:17:33
问题 I used the polygon command in R which created an area in the plot. However, the values in this area are not shown whereas the main aim is to monitor these values. Does anyone know how to handle this? 回答1: You can use The function rgb() to specify a color with an alpha transparency. for example : xx <- c(1:50) yy <- rnorm(50) n <- 50 hline <- 0 plot (yy ~ xx, type="n", axes=FALSE, ann=FALSE) text(x=xx,y=min(yy)+max(yy),labels='a') polygon(c(xx[1], xx, xx[n]), c(min(yy), yy, min(yy)), col=rgb(1

Drawing outlines around multiple geom_point groups with ggplot

回眸只為那壹抹淺笑 提交于 2019-12-03 10:56:06
I currrently have the code included below to draw this: What I am trying to do is get the outline for each of the groups to follow all of the points in each group - rather than skip some of them as it currently does. In addition I would want each outline to have a semi-transparent fill. Thanks for any help. library(ggplot2) library(reshape) library(car) G1 <- 1:10 G2 <- 11:20 G3 <- 21:30 G4 <- 31:35 G5 <- 36:41 sdata <- read.csv("http://dl.dropbox.com/u/58164604/sdata.csv", stringsAsFactors = FALSE) pdata<-melt(sdata, id.vars="Var") VarArea <- data.frame(unique(pdata$Var)) VarFinalMin <-c()

How to compute the union polygon of two (or more) rectangles

筅森魡賤 提交于 2019-12-03 09:06:47
For example we have two rectangles and they overlap. I want to get the exact range of the union of them. What is a good way to compute this? These are the two overlapping rectangles. Suppose the cords of vertices are all known: How can I compute the cords of the vertices of their union polygon? And what if I have more than two rectangles? There exists a Line Sweep Algorithm to calculate area of union of n rectangles. Refer the link for details of the algorithm. As said in article, there exist a boolean array implementation in O(N^2) time. Using the right data structure (balanced binary search