dofRintrusion
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 5.0, Creation date: 2020-12-31, Last change: 2025-09-15
provides the minimum intrusion distance to fully insert a cylinder into a sphere
Description
Better name would be dofarcchord:
a=asin(r/R)
d=(1-cos(a))*R
See Also: sofrd
, rofRintrusion
, PLchordof2PR
, Rofrdintrusion
Example Illustration
Syntax
d=dofRintrusion(R,r)
Input Parameter
R: | | Radius of sphere |
r: | | radius of cylinder |
Output Parameter
Examples
dofRintrusion(10,8)
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 calculates the minimum intrusion distance required to fully insert a cylinder into a sphere. The function is part of the SolidGeometry library and was introduced by Tim Lueth.
Input Parameters
- R: Radius of the sphere.
- r: Radius of the cylinder.
Output Results
- d: Distance required to insert the cylinder into the sphere.
Algorithm Steps
- Retrieve the radius of the sphere R and the radius of the cylinder r using the function
getfuncparams. Default values are 10 for R and 3 for r if not provided.
- Calculate the angle a using the formula:
a = asin(r/R).
- Compute the distance d using the formula:
d = (1 - cos(a)) * R.
- If no output is requested (
nargout == 0), visualize the result:
- Open a figure with
SGfigure(0,90).
- Plot the circle representing the sphere using
CPLplot(PLcircle(R),'r-').
- Plot the cylinder's position using
lplot([R-d r], [R-d -r],'g*-').
- Draw a line from the sphere's surface to the cylinder's edge with
lplot([R-d 0],[R 0],'m-',2,0,0).
- Zoom into the plot with
zoomVL to focus on the relevant area.
- Annotate the plot with the calculated distance d using
textP(p,'d').
- Add a plot annotation displaying the values of R, d, and r using
plotannotation.
Example
To calculate the intrusion distance for a sphere with radius 10 and a cylinder with radius 8, use:
dofRintrusion(10,8)
Algorithm explaination created using ChatGPT on 2025-08-19 00:29. (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