June 2015 archive

3D Line Fitting in 5 Easy Steps with SVD

Least squares fit is used for 2D line fitting. In 3D space, the line is called 3D Orthogonal Distance Regression (ODR) line. The line can be easily found in 3D using SVD (singular value decomposition). Assuming that we have a bunch of 3D points (x0, y0, z0) to (xn, yn, zn), the algorithm (in MATLAB) is as follows: …

Continue reading

Intersection of a Ray and a Line Segment in 3D

This page contains methods for performing various intersection tests. Although it does not have an entry for ray vs. line segment intersection, I tried the suggested ray vs. ray intersection test (page 782 of Real-Time Rendering 3rd Edition) and it did not work in my case. I looked around quite a bit and based on an …

Continue reading

Compilation Error when Invoking “CudafyTranslator.Cudafy()”

When using CUDAfy.NET, if you encounter the “Compilation Error” when running examples, simply add “cl.exe” to your PATH! It will resolve the translator exceptions. It’s funny how I didn’t find much about it online…