Syntax
r=corner2rad(d)
Input Parameter
Output Parameter
Examples
corner2rad(21) % Radius of Babuulab housing
Copyright 2023-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, corner2rad
, calculates the radius based on the distance to two tangents. It is part of the SolidGeometry library and was introduced in version 5.3. The function is authored by Tim C. Lueth and is classified under Analytical Geometry.
Input Parameters
- d: The distance to the tangents. This is the primary input parameter for the function.
Output Results
- r: The calculated radius based on the input distance.
Algorithm Steps
- The function begins by retrieving the input parameter
d
using the helper function getfuncparams
. If no input is provided, it defaults to 0.81.
- A constant
f
is defined as sqrt(2) - 1
.
- The radius
r
is calculated using the formula r = d / f
.
- If no output is requested (i.e.,
nargout == 0
), the function proceeds to visualize the result:
- It creates a figure using
SGfigure
.
- A circle is plotted with radius
r
using PLcircle
with 100 points and a quarter circle (pi/2).
- The center point
p1
is defined as [r r]
.
- The circle is plotted in red using
PLplot
.
- A line is plotted from the center to the edge of the circle in blue using
lplot
.
- Two tangent lines are plotted in black using
lplot
.
- Text annotations are added to display the distance
d
and the radius r
using textP
.
- The axis is set to tight to fit the plot using
axis tight
.
Example
To calculate the radius for a distance of 21 mm, use the function call: corner2rad(21)
. This example is specifically for the Babuulab housing.
Algorithm explaination created using ChatGPT on 2025-08-18 23:15. (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