Hello everyone, I've been coding a lot the past few days and I just wanted to share my code for those who may have some use for them, and also for me to keep track of my progress.
;********************************************************;
;; MA:perp-test - Test if two angles are perpendicular
;; Arguments:
;; - a (float): First angle in radians
;; - b (float): Second angle in radians
;; - tol (float): Tolerance value for comparison
;; Returns:
;; - test (bool): True if the angles are perpendicular within the given tolerance, False otherwise
;; Usage: (MA:perp-test a b tol)
(defun MA:perp-test (a b tol / test)
(if (and a b tol)
(if (< (abs (- (abs (cos a)) (abs (sin b)))) tol)
(setq test T)
(setq test nil)
)
)
)
This is a very simple script for when you want to compare two angles, especially of blocks you're working with. This can be modified to where it has a default tolerance value for orthogonality, but that would be a good exercise for you guys to test for yourselves.