Commit 2633fda0 authored by Jean-Yves TINEVEZ's avatar Jean-Yves TINEVEZ
Browse files

Refactor center point into a function.

parent 7ba91408
......@@ -3,15 +3,11 @@ function [ area, uncorr_area ] = area3d( o )
%% Deprojected 3D version.
p = o.boundary;
% Put all vertex coordinates with respect to center.
p = centered_points( o );
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.
index = [ 2 : n_vertices 1 ];
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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment