Skip to content

Instantly share code, notes, and snippets.

View tharindu-mathew's full-sized avatar

Tharindu Mathew tharindu-mathew

View GitHub Profile
@UnaNancyOwen
UnaNancyOwen / PCL1.7.2.props
Last active September 1, 2020 14:04
Property Sheet for Point Cloud Library
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets"/>
<!-- User Macros -->
<PropertyGroup Label="UserMacros">
<PCL_ROOT Condition="'$(Platform)'=='Win32'">$(ProgramFiles)\PCL 1.7.2</PCL_ROOT>
<PCL_ROOT Condition="'$(Platform)'=='x64'">$(ProgramW6432)\PCL 1.7.2</PCL_ROOT>
</PropertyGroup>
@ialhashim
ialhashim / fitting3D.cpp
Created November 14, 2014 23:17
Fitting 3D points to a plane or a line
template<class Vector3>
std::pair<Vector3, Vector3> best_plane_from_points(const std::vector<Vector3> & c)
{
// copy coordinates to matrix in Eigen format
size_t num_atoms = c.size();
Eigen::Matrix< Vector3::Scalar, Eigen::Dynamic, Eigen::Dynamic > coord(3, num_atoms);
for (size_t i = 0; i < num_atoms; ++i) coord.col(i) = c[i];
// calculate centroid
Vector3 centroid(coord.row(0).mean(), coord.row(1).mean(), coord.row(2).mean());