Difference between revisions of "Contrib snapEdgeDescription"

From OpenFOAMWiki
(Created page with "The idea behind snapEdge is pretty straightforward and I will try to describe it below. The first step is to extract the features from the STL. An STL is just a collection of t...")
 
Line 1: Line 1:
 
The idea behind snapEdge is pretty straightforward and I will try to describe it below.
 
The idea behind snapEdge is pretty straightforward and I will try to describe it below.
 +
The implementation however was not straightforward (as I thought it would be), but below is a description of how I want it to work.
 +
  
 
The first step is to extract the features from the STL.  
 
The first step is to extract the features from the STL.  
 +
 
An STL is just a collection of triangles and every edge thus has 2 triangles associated to it.  
 
An STL is just a collection of triangles and every edge thus has 2 triangles associated to it.  
 +
 
If it doesnt, it is a an edge and will be added to the feature lines.
 
If it doesnt, it is a an edge and will be added to the feature lines.
 +
 
Otherwise the dot product of the face normals is calculated (and normalized)
 
Otherwise the dot product of the face normals is calculated (and normalized)
 +
 
If it is equal to 1 it means that the two planes are parallel and if it is equal to 0 the planes are perpendicular.
 
If it is equal to 1 it means that the two planes are parallel and if it is equal to 0 the planes are perpendicular.
The feaureAngle decides which features should be included in the snapping.
+
 
 +
The feaureAngle then decides which edges should be included in the features used for the snapping.
 +
 
 +
The next step is to perform the same operation on the patches. (This step requires special care for parallel processing as it may extract false edges on the processor boundaries, which has not yet been included)
 +
 
 +
We now have a set of (mesh) edges that we want to attach (or snap) to the feature lines.
 +
 
 +
The third step is to loop over all the features and for each edge we calculate the
 +
distance for both points to that feature. If the distance to the feature is smaller than the tolerance * | edge length | we associate that edge
 +
to that feature line. It also needs to have the closest point inside the 2 points on the feature line.
 +
 
 +
If the edge already is associated with another feature line we check which one is best suited among the two features.
 +
This is based on angle and distance to the feature line. An edge may be close to the feature but is disregarded if the angle is too large.
 +
 
 +
After this step the 2 points on every edge have a final destination point on the associated feature line.
 +
This is the position to which the point want to move.
 +
 
 +
The fourth step is to check for overlaps. Two edges may be mapped in such a way that they occupy the same segment on the feature line.
 +
Thus every final destination point for each edge is mapped to other final destination points edges.
 +
If they overlap we need to decide which one we want to actually move.
 +
This is also based on angle and proximity. Although a point may be close it shouldn't be mapped if the edge is not parallell enough.
 +
This is set by the parallellAngle criteria. If the edge angles are below this, the closest point will be chosen, ottherwise the angle will decide.

Revision as of 17:57, 7 September 2010

The idea behind snapEdge is pretty straightforward and I will try to describe it below. The implementation however was not straightforward (as I thought it would be), but below is a description of how I want it to work.


The first step is to extract the features from the STL.

An STL is just a collection of triangles and every edge thus has 2 triangles associated to it.

If it doesnt, it is a an edge and will be added to the feature lines.

Otherwise the dot product of the face normals is calculated (and normalized)

If it is equal to 1 it means that the two planes are parallel and if it is equal to 0 the planes are perpendicular.

The feaureAngle then decides which edges should be included in the features used for the snapping.

The next step is to perform the same operation on the patches. (This step requires special care for parallel processing as it may extract false edges on the processor boundaries, which has not yet been included)

We now have a set of (mesh) edges that we want to attach (or snap) to the feature lines.

The third step is to loop over all the features and for each edge we calculate the distance for both points to that feature. If the distance to the feature is smaller than the tolerance * | edge length | we associate that edge to that feature line. It also needs to have the closest point inside the 2 points on the feature line.

If the edge already is associated with another feature line we check which one is best suited among the two features. This is based on angle and distance to the feature line. An edge may be close to the feature but is disregarded if the angle is too large.

After this step the 2 points on every edge have a final destination point on the associated feature line. This is the position to which the point want to move.

The fourth step is to check for overlaps. Two edges may be mapped in such a way that they occupy the same segment on the feature line. Thus every final destination point for each edge is mapped to other final destination points edges. If they overlap we need to decide which one we want to actually move. This is also based on angle and proximity. Although a point may be close it shouldn't be mapped if the edge is not parallell enough. This is set by the parallellAngle criteria. If the edge angles are below this, the closest point will be chosen, ottherwise the angle will decide.