Bsoft 2.1.4
Bernard's software package
model_plane.cpp File Reference

Library routines used for plane models. More...

#include "model_create.h"
#include "model_transform.h"
#include "model_views.h"
#include "model_util.h"
#include "utilities.h"

Functions

Vector3< double > model_fit_plane (Bmodel *model)
 Fits a plane through a model. More...
 
double model_distance_to_guide (Vector3< double > loc, Vector3< double > vec, Bmodel *guide, double sigma2)
 Calculates the distance between a location and the local guide model. More...
 
int model_adjust_to_guide (Bmodel *model, Bmodel *gmod, double sigma)
 Adjusts a shell model to the faces of a polyhedral guide model. More...
 
Bmodelmodel_generate_from_plane_guide (Bmodel *guide, double separation, double sigma)
 Generates a plane model and fits a plane through it. More...
 

Variables

int verbose
 

Detailed Description

Library routines used for plane models.

Author
Bernard Heymann
Date
Created: 20140925
Modified: 20141008

Function Documentation

◆ model_adjust_to_guide()

int model_adjust_to_guide ( Bmodel model,
Bmodel gmod,
double  sigma 
)

Adjusts a shell model to the faces of a polyhedral guide model.

For each component, it is determined whether it is located inside or 
outside the appropriate polyhedral face, and its coordinates adjust
closer to the face by the indicated fraction.
Parameters
*modelshell model.
*gmodguide polyhedron model.
sigmasmoothness of model.
Returns
int 0.

◆ model_distance_to_guide()

double model_distance_to_guide ( Vector3< double >  loc,
Vector3< double >  vec,
Bmodel guide,
double  sigma2 
)

Calculates the distance between a location and the local guide model.

Each guide component is used to calculate a distance of the location
to the guide plane and a lateral distance to the guide component.
The lateral distance is used to calculate a gaussian distributed weight
which in turn is used to calculate a weighted average of the distance
to the guide plane.
Parameters
loclocation to be tested.
vecdirection vector associated with the location.
*guideguide model.
sigma2smoothness weighting parameter.
Returns
Bmodel* new circle model.

◆ model_fit_plane()

Vector3< double > model_fit_plane ( Bmodel model)

Fits a plane through a model.

A plane is fit through the components and the normal calculated from:
    n•p = d
where n is the normal vector, p is a point in the plane, and d is the offset.
Only the first model is fit.
Parameters
*modelmodel structure.
Returns
Vector3<double> plane normal.

◆ model_generate_from_plane_guide()

Bmodel * model_generate_from_plane_guide ( Bmodel guide,
double  separation,
double  sigma 
)

Generates a plane model and fits a plane through it.

Parameters
*guidemodel structure.
separationseparation between components for new model.
sigmasmoothness of model.
Returns
Bmodel* new model based on input model.
The principal axes of a planar model are calculated and a new plane model
generated with the given separation between components.
The components of the new model are then adjusted to fit the guide model.

Variable Documentation

◆ verbose

int verbose
extern