SGconvexofSGintersect

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SG/Solids
Introduced first in SolidGeometry 5.0, Creation date: 2020-12-12, Last change: 2025-09-15

returns a solid to intersect or subtract

Description

Sometimes there is a need for intersecting just a part of a solid or get a simplified shape for subtraction or intersection

See Also: SGintersect , FLofcrossingSG , SGofVLdelaunay , SGremsurfedgepoints

Example Illustration

 missing image of SGconvexofSGintersect(SG,SGinter)

Syntax

CISG=SGconvexofSGintersect(SG,SGinter)

Input Parameter

SG: Solid Geometry A to intersect
SGinter: Intersecting Solid B

Output Parameter

CISG: Convex intersecting solid that contains alls surfaces of SG intersecting with SGinter

Examples


SGconvexofSGintersect(SGsphere(15),SGbox)




Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, SGconvexofSGintersect, is designed to compute the convex hull of the intersection between two solid geometries, SG and SGinter. It is part of the SolidGeometry library and was introduced in version 5.0.

Input Parameters

Output

Algorithm Steps

  1. Calculate the face indices of SG that intersect with SGinter using the function FLofcrossingSG.
  2. Extract the vertices and faces of SG that are involved in the intersection using the indices obtained in the previous step.
  3. Use the function VLFLshort to create a new structure with these vertices and faces.
  4. Suppress specific warnings related to triangulation using warning('off',...).
  5. Generate a convex hull from the vertices using SGofVLdelaunay.
  6. Remove unnecessary surface edge points using SGremsurfedgepoints.
  7. Restore the previous warning state.
  8. If no output is requested, visualize the result using SGfigure and SGplotalpha to plot SG, SGinter, and the resulting convex hull with different colors.

Visualization

If the function is called without an output argument, it will display a 3D plot with:

Annotations are added to the plot to describe the color coding.

Algorithm explaination created using ChatGPT on 2025-08-19 06:58. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21