SGisconvex

by Tim Lueth & Felix Schoppa, SG-Lib Toolbox: SolidGeometry 5.6 - Surfaces
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-03, Last change: 2025-09-14

returns whether a solid is convex

Description

WORK IN PROGRESS (2017-04-03)
A solid is convex if all normal vectors of the vertices have the same direction, i.e.if the angle between vector from center line to vertex and verte normal vector is less than 90 degree (pi/2);


See Also: SGisInterior

Example Illustration

 missing image of SGisconvex(SG)

Syntax

c=SGisconvex(SG)

Input Parameter

SG: Solid Geometry

Output Parameter

c: true if convex, false if not




Copyright 2017-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 algorithm determines whether a given solid geometry (SG) is convex. A solid is considered convex if all normal vectors of its vertices point in the same general direction, meaning the angle between the vector from the center line to a vertex and the vertex normal vector is less than 90 degrees (À/2).

Input Parameters

Output Results

Algorithm Steps

  1. Calculate the center point of the solid using the function SGgetCenterPoint(SG).
  2. Compute the vector from the center point to each vertex by subtracting the center point from each vertex in the vertex list (VL).
  3. Normalize these vectors to get unit vectors.
  4. Create a triangulation object using the face list (FL) and vertex list (VL).
  5. Calculate the normal vectors for each vertex using the vertexNormal function.
  6. Initialize a zero vector w to store angles and set the convexity flag c to true.
  7. Iterate over each vertex:
  8. If there is no output argument, plot the solid geometry:
Algorithm explaination created using ChatGPT on 2025-08-18 23:39. (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