Extract the Triangle Mesh contour-based on the cut Line Method

Source: Internet
Author: User
Intersection policy of plane and grid

The standard equation of a plane is

A x + B y + c Z + D = 0

Where (A, B, C) is the unit normal. The value of D is determined by substituting in the known point (PX, Py, PZ) on the plane, namely

D =-(a PX + B py + C PZ)

For a vertex (QX, QY, qz) the expression

Side (q) = A qx + B Qy + C qz + d

Can be used to determine which side of the plane the vertex lies on. if it is positive the point lies on the same side as the normal, if negative it lies on the other side, if zero it lies on the plane.

After determining if an edge intersects the cutting plane it is necessary to calculate the intersection point as that will become a vertex of the clipped facet. let the edge be between two points P0 and P1, the equation of the points along the line segment

P = P0 + U (P1-P0)

Where u lies between 0 and 1. Substituting this into the expression for the plane

A (p0x + U (p1x-p0x) + B (p0y + U (p1y-p0y) + C (p0z + U (p1z-p0z) + d = 0

Solving for u

U =-side (P0)/(side (P1)-side (P0 ))

Substituting this into the equation of the line gives the actual Intersection Point.

There are 8 different cases to consider, they are already strated in the table below and appear in order in the source code. the top two cases are when all the points are on either side of the clipping plane. the three cases on the left are when there is only one vertex on the clipping side of the plane, the three cases on the right occur when there are two vertices on the clipping side of the plane.

Note
When there is only one point on the clipping side the resulting Facet has 4 vertices, if the underlying database only deals with 3 vertex facets then this can be bisected using a number of methods.

When the facets to be clipped have more than 3 vertices then they can be subdivided first and each segment clipped individually.

The algorithm as presented has no divide by zero problems

The source below does the clipping in place, the order in which the vertices are calculated is important for the 3 cases when there is one point on the clipping side of the plane.

Intersection Line Strategy contour line interpolation to fit a curve using a spline

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.