User Tools

Site Tools


vmp.createsmp

vmp.CreateSMP

Motivation

Please refer to the Surface projection page for information on why to use this method and a practical example output.

Method reference ('vmp.Help('CreateSMP')')

 VMP::CreateSMP  - sample SMPs from the maps in a VMP
 
 FORMAT:       smp = vmp.CreateSMP(srf, opts)
 
 Input fields:
 
       srf         required surface file
       opts        1x1 struct with optional fields
        .interp    method ('nearest', {'linear'}, 'cubic')
        .ipfrom    interpolate from P + n * normal vector, default: -3
        .ipstep    interpolation stepsize, default: 1 (in normal vectors)
        .ipto      interpolate to P + n * normal vector, default: 1
        .mapsel    map selection, default: all maps in VMP
        .method    method to get value ('max', {'mean'}, 'median', 'min')
        .recalcn   boolean, recalc normals before sampling, default: false
 
 Output fields:
 
       smp         SMP object with as many maps as selected
 
 Note: results slightly differ from BV's results (sampling method)

Usage examples

  • simple conversion of all maps in a VMP with default parameters:
    vmp_createsmp_example1.m
    % load VMP and SRF
    vmp = xff('*.vmp', 'Please select a VMP for SMP creation...');
    srf = xff('*.srf', 'Please select a surface to sample VMP at...');
     
    % convert to SMP
    smp = vmp.CreateSMP(srf);
     
    % save as and clear all VMP/SRF objects
    smp.SaveAs;
    vmp.ClearObject;
    srf.ClearObject;
  • only convert first map with cubic interpolation and sampled just at the vertex:
    vmp_createsmp_example2.m
    smpcreateopts = struct( ...
        'interp', 'cubic', ...
        'ipfrom', 0, ...
        'ipto',   0, ...
        'mapsel', 1);
    smp = vmp.CreateSMP(srf, smpcreateopts);
  • recreate normals before sampling:
    vmp_createsmp_example3.m
    smp = vmp.CreateSMP(srf, struct('recalcn', true));
vmp.createsmp.txt · Last modified: 2010/06/14 19:00 by jochen