Skip to content
Snippets Groups Projects
Commit 2633fda0 authored by Jean-Yves TINEVEZ's avatar Jean-Yves TINEVEZ
Browse files

Refactor center point into a function.

parent 7ba91408
No related branches found
No related tags found
1 merge request!9Rework the whole code for the upcoming publication.
...@@ -3,15 +3,11 @@ function [ area, uncorr_area ] = area3d( o ) ...@@ -3,15 +3,11 @@ function [ area, uncorr_area ] = area3d( o )
%% Deprojected 3D version. %% Deprojected 3D version.
p = o.boundary; % Put all vertex coordinates with respect to center.
p = centered_points( o );
n_vertices = size( p, 1 ); n_vertices = size( p, 1 );
% Put all vertex coordinates with respect to center.
center = mean( p );
center = repmat( center, [ n_vertices, 1 ] );
p = p - center;
% Build small triangles. % Build small triangles.
index = [ 2 : n_vertices 1 ]; index = [ 2 : n_vertices 1 ];
p1 = p; p1 = p;
......
function p = centered_points( o )
%CENTERED_POINTS Returns the 3D coordinates of the object bounds, with
%respect to its center.
p = o.boundary;
n_vertices = size( p ,1 );
center = mean( p );
center = repmat( center, [ n_vertices, 1 ] );
p = p - center;
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment