Rank: 5095 based on 19 downloads (last 30 days) and 1 file submitted
photo

Germano Gomes

E-mail
Company/University
Gent University

Personal Profile:

 

Watch this Author's files

 

Files Posted by Germano Gomes
Updated   File Tags Downloads
(last 30 days)
Comments Rating
02 Jun 2014 Screenshot PCA_Weighted.m Weighted PCA on 3D triangle meshes Author: Germano Gomes weighted pca, 3d mesh, transformation, computational geometr..., feature extraction 19 0
  • 5.0
5.0 | 1 rating
Comments and Ratings by Germano Gomes View all
Updated File Comments Rating
21 Jan 2014 geom3d Library to handle 3D geometric primitives: create, intersect, display, and make basic computations Author: David Legland

Great library, i use it all the time, thanks.
A small correction for:

function normals = faceNormal(nodes, faces)

if isnumeric(faces)
% compute vector of first edge
v1 = nodes(faces(:,2),1:3) - nodes(faces(:,1),1:3);
v2 = nodes(faces(:,3),1:3) - nodes(faces(:,1),1:3);

% normalize vectors
% v1 = normalizeVector3d(v1); % remove
% v2 = normalizeVector3d(v2); % remove

% compute normals using cross product
normals = cross(v1, v2, 2);
normals= normalizeVector3d(normals); % correction GTG 2014

else
normals = zeros(length(faces), 3);

for i=1:length(faces)
face = faces{i};
% compute vector of first edges
v1 = nodes(face(2),1:3) - nodes(face(1),1:3);
v2 = nodes(face(3),1:3) - nodes(face(1),1:3);

% normalize vectors
% v1 = normalizeVector3d(v1); % remove
% v2 = normalizeVector3d(v2); % remove

% compute normals using cross product
normals(i, :) = cross(v1, v2, 2);
end
normals= normalizeVector3d(normals);% correction GTG 2014
end

---------------
Always better to normalize at the end otherwise the final normals are not normalized because of roundoff etc errors in the cross computation, this also has the advantage of eliminating 2 calls to normalizeVector3d, making faceNormal a tad faster.

04 Oct 2013 Ray casting for deformable triangular 3D meshes Ray casting or collision detection for deformable triangular 3D meshes. Author: Vipin Vijayan

Note(ray casting): the correct value of 'd' is obtained by normalizing each column of the (to-from) 3xN matrix. I use Matlab normc for this:

[hit,d,trix,bary] = t.intersect(from,normc(to-from));

do not use:

[hit,d,trix,bary] = t.intersect(from,(to-from)./norm(to-from));

if you have more than one vector/ray

03 Oct 2013 Ray casting for deformable triangular 3D meshes Ray casting or collision detection for deformable triangular 3D meshes. Author: Vipin Vijayan

Very useful Matlab wrapper for fast collision detection and ray tracing.

For those using Matlab win64: look at the error information and comment out (//) the machine code (the __asm keyword invokes the inline assembler).

Example solution: error fix in IceFPU.h line 47:

//! Fast square root for floating-point values.
inline_ float FastSqrt(float square)
{
// #ifdef _MSC_VER
// float retval;
//
// __asm {
// mov eax, square
// sub eax, 0x3F800000
// sar eax, 1
// add eax, 0x3F800000
// mov [retval], eax
// }
// return retval;
// #else
return sqrt(square);
// #endif

In all cases just leave the code below #else (this is in vanilla C++) that does the same work without any incompatibility with win64.

Finally, unfortunately the returned d (matrix of distances) returns wrong values that seem to be scaled or shifted by the number of rays (vectors from-to), even if this vector is normalized as suggested by Vipin.
Vipin can you check and fix this please.

For it to be perfect I suggest returning the correct 'd' matrix, not needing the normalization step in Matlab and returning the intersection points(Q matrix) from the Mex function. That would be nice.

Thank you Vipin

03 Oct 2013 Ray casting for deformable triangular 3D meshes Ray casting or collision detection for deformable triangular 3D meshes. Author: Vipin Vijayan

06 Sep 2010 mex_sepsq Fast, dedicated, code to compute Euclidean separation between sets of points in N-dimensional space. Author: Ben Mitch

I believe that in 3D something like this is almost as fast for number of points >1000, ratio is approximately =2.
function [Dist] = Distance3DFast(M1,M2)
% M1 is a 3xN matrix
% M2 is a 3xM matrix
%Dist is a NxM matrix
%example:
% M1=rand(3, 10000); M2=rand(3,10000);
% Dist=Distance3DFast(M1,M2);
Dist = sqrt(bsxfun(@plus,dot(M1,M1)',dot(M2,M2))-2*M1'*M2);

Comments and Ratings on Germano Gomes' Files
Updated File Comment by Comments Rating
07 Oct 2014 PCA_Weighted.m Weighted PCA on 3D triangle meshes Author: Germano Gomes Glen Lichtwark

Contact us