### Convert to junction graph to vertices and faces.

```The goal is to be able to plot the tissue with one face per cell, to
have a simplified representation of the cells on the tissue with e.g.:
>> patch( 'Faces', F, 'Vertices', V, 'FaceColor', 'g' )```
parent 5722144c
 ... ... @@ -26,6 +26,11 @@ classdef deproj % Exports results to a spreadsheet file. to_file( obj, file_name, include_header ) %% Conversion between MATLAB objects. % Returns the faces and vertices of a deproj collection. [ V, F ] = to_vertices_and_faces( obj ) %% Generate figures. % Figure with the local plan orientation for a collection of epicells. ... ...
 function [ V, F ] = to_vertices_and_faces( obj ) %TO_FACES Returns the faces and vertices of a deproj collection. % The vertices are made of the junction centroid coordinates. % Each face is one epicell, enclosed by the junctions around it. % Collect vertices. g = obj.junction_graph; V = g.Nodes.Centroid; % Collected junction ids. ids = { obj.epicells.junction_ids }'; n_vertices = cellfun(@numel, ids ); max_n_vertices = max( n_vertices ); n_obj = numel( obj.epicells ); % Write into the face matrix. F = NaN( n_obj, max_n_vertices ); for i = 1 : n_obj jids = ids{ i }; P = V( jids, : ); % Sort the points so that we don't have intersecting polygons. [ ~, I ] = deproj.sort_polygon( P ); F( i, 1 : n_vertices(i) ) = jids( I ); end end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!