plane

Calculating a 2D joint probability distribution

和自甴很熟 提交于 2019-12-06 01:30:33
I have many points inside a square. I want to partition the square in many small rectangles and check how many points fall in each rectangle, i.e. I want to compute the joint probability distribution of the points. I am reporting a couple of common sense approaches, using loops and not very efficient: % Data N = 1e5; % number of points xy = rand(N, 2); % coordinates of points xy(randi(2*N, 100, 1)) = 0; % add some points on one side xy(randi(2*N, 100, 1)) = 1; % add some points on the other side xy(randi(N, 100, 1), :) = 0; % add some points on one corner xy(randi(N, 100, 1), :) = 1; % add

How to efficiently rotate and translate a plane in 3D

帅比萌擦擦* 提交于 2019-12-05 02:44:56
问题 I have a plane defined by a normal (n) and a distance (d) (from the origin). I would like to transform it into a new system. The long way is like this: 1) multiply distance (d) with normal (n) resulting in a a vector (p) 2) rotate (R) and translate (v) the vector (p) to get (p') 3) normalize (p') to get the normal 4) use another algorithm to find the smallest distance (d') between the new plane and the origin I haven't tried this but I guess it should work. QUestion: Isn't there a faster way

Plane fit of 3D points with Singular Value Decomposition

岁酱吖の 提交于 2019-12-04 21:41:46
Dear fellow stackoverflow users, I am trying to calculate the normal vectors over an arbitrary (but smooth) surface defined by a set of 3D points. For this, I am using a plane fitting algorithm that finds the local least square plane based on the 10 nearest neighbors of the point at which I'm calculating the normal vector. However, it does not always find what seems to be the best plane. Thus, I'm wondering whether there is a flaw in my implementation or a flaw in my algorithm. I'm using Singular Value Decomposition as I found recommended in several links on the subject of plane fitting. Here

LibGDX guidance - sprite tracing 2D infinite random bezier curve

亡梦爱人 提交于 2019-12-04 11:43:55
I've been able to apply a smooth animation to my sprite and control it using the accelerometer. My sprite is fixed to move left and right along the x-aixs. From here, I need to figure out how to create a vertical infinite wavy line for the sprite to attempt to trace. the aim of my game is for the user to control the sprite's left/right movement with the accelerometer in an attempt to trace the never ending wavy line as best they can, whilst the sprite and camera both move in a vertical direction to simulate "moving along the line." It would be ideal if the line was randomly generated. I've

How to convert a 3D point on a plane to UV coordinates?

佐手、 提交于 2019-12-04 04:08:16
I have a 3d point, defined by [x0, y0, z0] . This point belongs to a plane, defined by [a, b, c, d] . normal = [a, b, c] , and ax + by + cz + d = 0 How can convert or map the 3d point to a pair of (u,v) coordinates ? This must be something really simple, but I can't figure it out. First of all, you need to compute your u and v vectors. u and v shall be orthogonal to the normal of your plane, and orthogonal to each other. There is no unique way to define them, but a convenient and fast way may be something like this: n = [a, b, c] u = normalize([b, -a, 0]) // Assuming that a != 0 and b != 0,

How to efficiently rotate and translate a plane in 3D

徘徊边缘 提交于 2019-12-03 21:02:26
I have a plane defined by a normal (n) and a distance (d) (from the origin). I would like to transform it into a new system. The long way is like this: 1) multiply distance (d) with normal (n) resulting in a a vector (p) 2) rotate (R) and translate (v) the vector (p) to get (p') 3) normalize (p') to get the normal 4) use another algorithm to find the smallest distance (d') between the new plane and the origin I haven't tried this but I guess it should work. QUestion: Isn't there a faster way to get n' and d'? If the translation (v) is 0 than I can skip 4). But if it is not 0? Is there an

3D Ray-Quad intersection test in java

随声附和 提交于 2019-12-03 07:57:12
In 3D space I am trying to determine if a ray/line intersects a square and if so, the x and y position on the square that it intersects. I have a ray represented by two points: R1 = (Rx1, Ry1, Rz1) and R2 = (Rx2, Ry2, Rz2) And the square is represented by four vertices: S1 = (Sx1, Sy1, Sz1), S2 = (Sx2, Sy2, Sz2), S3 = (Sx3, Sy3, Sz3) and S4 = (Sx4, Sy4, Sz4). I’ve found lots of algebraic equations for this online but none seem to fit this problem exactly. Ideally I would like the answer in Java code, but an equation that I can easily convert to code will do also. All help will be appreciated.

3D Plane fitting algorithms

一个人想着一个人 提交于 2019-12-03 07:20:38
问题 So I'm working on a project where me and a buddy of mine scanned a room using the KINECTv2 and made a 3D model out of it. The goal is to make it possible to add 3d models of different kinds of furniture in real time. To that goal I'm trying out different plane-fitting algorithms in order to find wich one would work the fastest. Does anybody have any suggestions? So far I've only researched the usage of the basic RANSAC algorithm included in PCL. 回答1: Two common approaches for plane fitting

Find OpenGL rotation matrix for a plane, given the normal vector after the rotation

别来无恙 提交于 2019-12-03 06:18:46
问题 Is there a way to obtain the matrix which rotates a plane to a new orientation, given its new normal vector The following image depicts what is described 回答1: Given the old normal N and the new normal N' you can obtain the rotation by: RotationAxis = cross(N, N') RotationAngle = arccos(dot(N, N') / (|N| * |N'|)) Where cross(x, y) is the cross product of the vectors x and y dot(x, y) is the dot product of the vectors x and y |x| is the length of the vector x This will rotate the old normal

C++ plane interpolation from a set of points

百般思念 提交于 2019-12-03 00:05:22
问题 I am programming in C++ with the PCL, point cloud, library. My problem is: computing the variance of some of the points but only with respect to the perpendicular axis with respect to the plane. I will explain myself: So what I am doing is dividing the point cloud into segments by surface smoothness (with region growing segmentation). For each segment I would like to have a measurement of how accurate the surface is, and I thougth the best way was to compute the plane that best fits the