Questions tagged [centroid]

Centroid refers to the center of a geometric shape. It may also refer to the center of a clustered point-cloud.

Centroid is the center of a geometric shape. Also known as its center of mass.
See Wikipedia for more information.

310 questions
4
votes
1 answer

Zip-Centroid geo-coding: is there a zip+4 centroid

There is geo-coding by zip-code centroid, but is there a zip+4 centroid which would be more granular yet not quite street-address granularity?
Tim
  • 8,669
  • 31
  • 105
  • 183
3
votes
3 answers

The centroid of a list of points

New to Haskell The problem is -- The centroid of a list of points is a point whose x (and y) coordinates are -- the means of the x (and y) coordinates of the points in the list. -- -- You may assume the list contains at least one point. -- -- >…
Lmmmmmmc
  • 87
  • 2
3
votes
1 answer

Find visual center of a polygon

Follow up from this question: gCentroid shifting centroid towards concentration of points, but with a trickier shape. Using this SpatialPointsDataFrame I calculated the center using gCentroid, but it places it outside the shape. # c. = [dput'd data…
Rafael
  • 3,096
  • 1
  • 23
  • 61
3
votes
1 answer

Centroidal Voronoi tessellation

I am trying to build a bounded Voronoi diagram using the scipy package and in each iteration I compute the centroids of the Voronoi cells and move a bit say some delta towards the centroid and recompute the Voronoi diagram by updating the generator…
Cosmic
  • 73
  • 7
3
votes
1 answer

Error whilst performing gCentroid in R

I am unable to get centroids from polygons in R. The confusing bit is, it used to work in the past and has suddenly stopped working! This is the piece of code: polygon.centroids <- SpatialPointsDataFrame(gCentroid(polygon, byid = TRUE), …
VGu
  • 386
  • 5
  • 23
3
votes
1 answer

Extract centroid of shape file object in R?

I have a shape file, uploaded at the following path: https://drive.google.com/open?id=0B1ITb_7lHh1EUFVfVWc4ekRfSnc I imported the data using the "read.shapefiles" function in "shapefiles" package: landuse<- read.shapefile("landuse") I now need to…
Shaz
  • 131
  • 1
  • 8
3
votes
1 answer

calculate centroid of SKSpriteNode for anchor point

I have a SKSpriteNode which is an image of a equilateral triangle, I want to set it's anchor point at the triangle's centroid so I can get it to rotate smoothly and remain in centre. I have calculated the centroid with the code bellow but these…
jm1175
  • 165
  • 10
3
votes
3 answers

Centroid of matrix

Given a 2D array, I am required to come up with an algorithm which outputs the center of mass. I came up with algorithm below, however, it is producing incorrect solution when the array size is increased to 10 x 10 matrix. I wrote and ran the…
user3453250
  • 59
  • 1
  • 9
3
votes
1 answer

Three.js r68 - Can't get centroids of geometries using OBJMTLLoader

I've been using an old revision of Three.js for quite some time, so I decided to upgrade to the latest (r68). I knew I would bump into some issues, but I wasn't expecting the removal of geometry.computeCentroids() and .centroid property. I'm loading…
VitorOliveira
  • 35
  • 2
  • 8
3
votes
2 answers

Python: Spectral Centroid for a .wav file?

I need do define a "spectral centroid" function that will analyze an audio file but I'm not able to convert the mathematical formula into code. If anybody could help me it would be great, I'm out of ideas. the formula in question…
user3765226
  • 33
  • 1
  • 5
3
votes
1 answer

Fuzzy Logic in Java: Having troubles implementing the defuzzification process (using the centroid method)

I have implemented a whole fuzzy logic system in Java, but I am having serious issues on the defuzzification process. In my code, I defined my inputs as time and distance, and the output is simply output. I have every linear function that constructs…
theJuls
  • 6,788
  • 14
  • 73
  • 160
3
votes
2 answers

Image processing -Algorithm to calculate centroids of white space in binary image

The problem is that I need a simplified version of algorithm, which can calculate centroid of several white contours in a binary image. For example, if there is only one white contour, coordinates Xc and Yc of the contour center are calculated…
user3029227
  • 121
  • 2
  • 8
3
votes
1 answer

How to Calculate Centroid of polygon in C

I'm trying to rotate the polygon around centroid but I confused about coding from formulas. float x[32]; float y[32]; float cx=0; float cy=0; int j,n; printf("How many angles :") scanf("%d" ,&n); //get (x[j],y[j]); for (j=0; j
Barbiyong
  • 147
  • 1
  • 4
  • 14
3
votes
1 answer

Spatial SQL query showing parcels containing centroid of building

I am trying to write a query that selects parcels that contain the centroid of a certain building code (bldg_code = 3). The parcels are listed in the table "city.zoning" and contains a column for a PIN, geometry, and area of each parcel. The table…
mbcaradima
  • 251
  • 2
  • 11
3
votes
0 answers

Getting approximate vertices of curved-edge closed shapes (for calculating centroid and other properties)

I'm looking to draw outlines of 2D-closed irregular shapes with curved edges, and then compute both (a) the center of gravity (centroid) of the shape's area, and (b) the center of gravity of the shape's perimeter (i.e. the centroid of, e.g., a wire…
Chaz
  • 31
  • 2
1 2
3
20 21