computational-geometry

python implementation of 3D rigid body translation and rotation

為{幸葍}努か 提交于 2020-06-10 17:41:23
问题 I've been trying to work out how to solve the following problem using python: We have points a, b, c, d which form a rigid body Some unknown 3D translation and rotation is applied to the rigid body We now know the coordinates for a, b, c We want to calculate coordinates for d What I know so far: Trying to do this with "straightforward" Euler angle calculations seems like a bad idea due to gimbal lock etc. Step 4 will therefore involve a transformation matrix, and once you know the rotation

Python: fit 3D ellipsoid (oblate/prolate) to 3D points

守給你的承諾、 提交于 2020-05-14 09:13:02
问题 Dear fellow stackoverflow users, I face a problem as follows: I would like to fit a 3D ellipsoid to 3D data points within my python script. The starting data are a set of x, y and z coordinates (cartesian coordinates). What I would like to get are a and c in the defining equation of the best-fit ellipsoid of the convex hull of the 3D data points. The equation is, in the properly rotated and translated coordinate system: So the tasks I would ideally like to do are: Find convex hull of 3D data

How to plot geodesic curves on a surface embedded in 3D?

寵の児 提交于 2020-04-28 08:44:12
问题 I have in mind this video, or this simulation, and I would like to reproduce the geodesic lines on some sort of surface in 3D, given by a function f(x,y), from some starting point. The midpoint method seems computationally and code intense, and so I'd like to ask if there is a way to generate an approximate geodesic curve based on the normal vector to the surface at different points. Each point has a tangent vector space associated with it, and therefore, it seems like knowing the normal

Get all points of a straight line in python

こ雲淡風輕ζ 提交于 2020-02-27 03:37:24
问题 Very simply, given a point A(x,y) and another point B(m,n), I need a function that can return in any iterable object a list[k,z] of all points in between. Am only interested in integer points, so no need for floats. I need the best possible pythonic way because this 'little' function is going to be heavily run and is the key pillar of a larger system. EDIT: @roippi, thanks pointing out the gotcha concerning the integers. From my code below, you can see I try to step across the x axis and get

Intersection of nD line with convex hull in Python

守給你的承諾、 提交于 2020-01-31 04:24:07
问题 I have created a convex hull using scipy.spatial.ConvexHull. I need to compute the intersection point between the convex hull and a ray, starting at 0 and in the direction of some other defined point. The convex hull is known to contain 0 so the intersection should be guaranteed. The dimension of the problem can vary between 2 and 5. I have tried some google searching but haven't found an answer. I am hoping this is a common problem with known solutions in computational geometry. Thank you.

Example data set for the k-Nearest Neighbors algorithm?

半城伤御伤魂 提交于 2020-01-24 10:54:28
问题 What is an example of a data set one would use with the k-Nearest Neighbors algorithm? I understand the concept but I am unsure about what kind of data one would use for the x, y coordinates. Can one provide an example of a dataset (with x, y coordinates) for the nearest-neighbor-k algorithm ? 回答1: NN search is in a simple way this: You have a database of elements (here you have 2 dimensional points, with coordinates x and y ). A query comes, which is the same type of the elements of the

Example data set for the k-Nearest Neighbors algorithm?

让人想犯罪 __ 提交于 2020-01-24 10:54:06
问题 What is an example of a data set one would use with the k-Nearest Neighbors algorithm? I understand the concept but I am unsure about what kind of data one would use for the x, y coordinates. Can one provide an example of a dataset (with x, y coordinates) for the nearest-neighbor-k algorithm ? 回答1: NN search is in a simple way this: You have a database of elements (here you have 2 dimensional points, with coordinates x and y ). A query comes, which is the same type of the elements of the

A Brute-Force Constrained Delaunay Triangulation?

只谈情不闲聊 提交于 2020-01-21 05:30:30
问题 I need to create a triangle mesh from a set of points. The set has very few points so it doesn't need to be fast or optimised (I will deal with 100 points maximum). The mesh needs to be a constrained "delaunay triangulation". In the image below I showed (on the left) the set of points I start from (blue and red dots). I also know the connections between these points (the outline in black). The mesh needs to look like the example on the right (including the edges in grey that form outside and

How can a find a face containing a predefined point when i have a planar graph embedded on a plane

人盡茶涼 提交于 2020-01-15 06:00:11
问题 I have a planar graph embedded on a plane (plane graph ) and want to search its faces. The graph is not connected but consists of several connected graphs, which are not separately adressable (e.g. a subgraph can be contained in the face of another graph) I want to find the polygons (faces) which include a certain 2d point. The polygons are formed by the faces of the graphs. As the number of faces is quite big I would like to avoid to determine them beforehand. What is the general complexity

How can a find a face containing a predefined point when i have a planar graph embedded on a plane

孤人 提交于 2020-01-15 06:00:10
问题 I have a planar graph embedded on a plane (plane graph ) and want to search its faces. The graph is not connected but consists of several connected graphs, which are not separately adressable (e.g. a subgraph can be contained in the face of another graph) I want to find the polygons (faces) which include a certain 2d point. The polygons are formed by the faces of the graphs. As the number of faces is quite big I would like to avoid to determine them beforehand. What is the general complexity