STUDI • MARIANO TOMATIS ANTONIONO

TORNA ALL'INDICE

Analysis of alignments in R-Environment - Two definitions

A DETAILED GUIDE TO THE GEOMETRICAL STUDY OF SACRED GEOMETRIES AND ORTHOTENY • JULY 12, 2007

Orthoteny and the study of Sacred Geometry both deal with the analysis of alignments of relevant items: in Orthoteny the item is the UFO sighting, in Sacred Geometry the item is the topographical place in which "something" is considered important (a church, a peak, a grotto or a menhir).

In this article I'll try to define precisely the concept of alignment. I will suggest two different definitions:

Definition #1

Given a cartesian plan and two points A and B with coordinates (X1,Y1) and (X2,Y2), any C point with coordinates (XC,YC) will be "aligned" to A and B if the distance between C and the line defined by A and B is smaller than a given tolerance E.

This first definition includes a tolerance parameter E, so we'll say that "C is aligned to A and B (or that A, B and C are aligned) with a tolerance equal to E". In this case, the definition considers A and B as generators of a linear corridor described by two parallel lines at the distance of 2E. Every point which is inside the corridor is considered "aligned" to A and B.

According to Definition #1 the green points are aligned to A and B because the distance between them and the dashed line linking A and B is smaller than E, and the red points are not aligned. Note the corridor defined by the two parallel lines, both at a distance from the main line equal to E.

It is very easy to define a boolean function (in R-Environment) which returns TRUE or FALSE when called with the three points and the tolerance in input:

aligned <- function(x1,y1,x2,y2,x3,y3,e)
abs((y2-y1)*x3+(x1-x2)*y3+(x2*y1-x1*y2))/sqrt((y2-y1)^2+(x1-x2)^2)<e

The aligned function gets as input: (x1,y1) first point, (x2,y2) second point, (x3,y3) point to be analysed, e tolerance.

In the previous image we want to analyse the alignment of C(89,107) and D(139,75) with A(47,79) and B(170,53) with the tolerance E=22.

By calling aligned(47,79,170,53,89,107,22) we get FALSE - as expected: the point C is not aligned to A and B.

By calling aligned(47,79,170,53,139,75,22) we get correctly TRUE: the point D is aligned to A and B.

With the function provided you have in your hands the powerful tool which draws a solid line between precise and unprecise alignments; obviously, the definition of the "correct" tolerance parameter remains the main problem (1).

Definition #2

Given a cartesian plan and two points A and B with coordinates (X1,Y1) and (X2,Y2), any C point with coordinates (XC,YC) will be "aligned" to A and B if - considering the triangle ABC - the angle in A and the angle in B are both smaller than a given tolerance E.

Also this second definition includes a tolerance parameter E, defined as an angle. Again we'll say that "C is aligned to A and B (or that A, B and C are aligned) with a tolerance equal to E degrees". In this case, the definition considers A and B as generators of three areas defined by the four lines forming an angle of E° with the line defined by A and B. Every point inside this three areas is considered "aligned" to A and B.

According to Definition #2 the green points are aligned to A and B because they are inside the yellow areas defined by the four lines forming an angle of E degrees with the line linking A and B. The red points are not aligned because they are out of the areas.

This second definition would solve this problem:

A point like C, clearly not aligned to A and B, would be considered "aligned" by definition #1. Definition #2 correctly recognise it as not aligned because - given the triangle ABC - the angle in A is 90°!

It is a bit more difficult to define a boolean function which returns TRUE or FALSE when called with the three points and the tolerance in input. Firstly we should define a function calculating the angle formed by three points:

angle <- function (x1,y1,x2,y2,x3,y3)
{
   u1 <- x1-x3;
   u2 <- y1-y3;
   d1 <- x2-x3;
   d2 <- y2-y3;
   Lu <- sqrt(u1*u1 + u2*u2);
   u1 <- u1/Lu;
   u2 <- u2/Lu;
   Ld <- sqrt(d1*d1 + d2*d2);
   d1 <- d1/Ld;
   d2 <- d2/Ld;
   k <- u1*d1 + u2*d2;
   180*acos(k)/3.1415
}

angle function returns the angle in (x3,y3) (expressed in degrees from 0° to 180°) when given in input the coordinates of the other two vertices (x1,y1) and (x2,y2).

The boolean function aligned, like in definition #1, returns TRUE or FALSE if the point (x3,y3) is or not aligned to (x1,y1) and (x2,y2):

aligned <- function(x1,y1,x2,y2,x3,y3,e)
   angle(x3,y3,x1,y1,x2,y2)<e | angle(x3,y3,x2,y2,x1,y1)<e

1.Is there any "correct" value for E? Obviously not: every point could be considered "aligned" to A and B, when you fix a E value greater than the distance between the point and the line defined by A and B!

© 2017 Mariano Tomatis Antoniono