ashft

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Automatic Design
Introduced first in SolidGeometry 5.2, Creation date: 2022-03-31, Last change: 2025-09-15

creates a irrational number between and 66 degree (1.155 rad)

Description

This function is used if in an repeated way boolean functions are used with the same geometry
zz=2*pi/exp(1);
pp=primes(100);
a=zz/pp(end+1-i);
the function creates an irrational number based on pi/exp(1)/pime numbers to avoid any kind a repeated angles. The use of SGremsurfedgepoints is still recommended.


See Also: SGsubtract , SGunion

Example Illustration

 missing image of ashft(i)

Syntax

a=ashft(i)

Input Parameter

i: number between 1 and 25

Output Parameter

a: angle to turn

Examples


A=SGbox([30 20 10]); B=SGcylinder(1,20); GPLauxgridpointsCPS2(CPLbuffer(PLsquare([30,20]),-1.5),10); PL=ans; CPSplot(PLsquare([30,20]))
%% FAILS
C=A; for i=1:size(PL,1); Bi=SGtransP(B,[PL(i,:) -10]); C=SGsubtract(C,Bi); end; cla; SGplotalpha(C); view(-30,30);
%% NO PROBLEMS
C=A; for i=1:size(PL,1); Bi=SGtransR(B,rot(0,0,ashft(i))); Bi=SGtransP(Bi,[PL(i,:) -10]); C=SGsubtract(C,Bi); end; cla; SGplotalpha(C); view(-30,30);




Copyright 2022-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)

The function ashft is designed to generate an irrational angle based on a combination of mathematical constants and prime numbers. This is useful in scenarios where repeated boolean operations are performed on the same geometry, and unique angles are needed to avoid repetitive patterns.

Input Parameters

Output

Algorithm Explanation

The function begins by calculating a constant zz, which is defined as 2 * pi / exp(1). This value is a fixed irrational number derived from the mathematical constants pi and e.

Next, the function generates a list of prime numbers up to 100 using the primes function. This list is stored in the variable pp.

The core calculation of the function is performed by dividing zz by a specific prime number from the list pp. The index of the prime number is determined by the input parameter i. Specifically, the function uses the prime number at the position end + 1 - i in the list pp. This ensures that the angle a is unique for each value of i and avoids repetition.

The result is an irrational angle a that can be used to rotate geometric objects in a way that minimizes the likelihood of repeated patterns.

Example Usage

The example provided in the comments demonstrates how the ashft function can be used in conjunction with other functions from the SolidGeometry library to perform boolean operations on geometric shapes without encountering issues related to repeated angles.

Algorithm explaination created using ChatGPT on 2025-08-19 01:33. (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