Skip to content

Implement @@spoly #129

Description

@msdemlei

Currently, the @@ operator only works for scircles (and I think spoints). It is occasionally useful to also obtain the centroid of a polygon.

I have not thought about this in depth, but I think it ought to be fine just to compute the mean of the vertexes; what with poles and the stitching line, this has quite a few subtleties, too. What I do in some non-DB code is this:

		vertices = [numpy.array(mathtricks.spherToCart(p.x, p.y))
			for p in self.points]
		center = numpy.average(vertices, axis=0)
		center = center/(center@center)
		return mathtricks.cartToSpher(center)

– that is, I'm taking the mean of the unit sphere coordinates of the vertices and then convert the resulting vector (after normalisation) to spherical coordinates. Do people think this is the right way to do that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions