Close

Whether it is Greek to You or Me ...

A project log for Narcissus 12.0

This project will explore a number of issues that are involved in creating a personality for an interactive chat-bot or actual robot.

glgormanglgorman 05/10/2024 at 05:180 Comments

So, I found a copy of Euclid's Elements online and started reviewing some of the classic geometric methods., and then I got an interesting idea.  How hard would it be to implement all 200 or so proofs, or however many there are, in C++?  Of course, when working with computer graphics we have to proceed analytically, but that doesn't mean that we can't, at least in principle come up with ways to do some of the traditional compass and straight-edge constructions, that everyone seems to have forgotten with all of the 3-D mania.  Then again, there are some things quite wonderful and elegant about triangles, that are perhaps, underappreciated.  Like the fact we can subdivide a triangle by bisecting the edges, or else we can subdivide a triangle by bisecting the angles, and the results are not necessarily the same! Much to the surprise of many, no doubt! 

////////////////////////////////////////////////////////////////////
//
// PROP. IX.—Problem.
// To bisect a given rectilineal angle (BAC).
//
// THE ELEMENTS OF EUCLID - Translated by John Casey
// Published 1887 by Cambridge Press, public domain.
//
////////////////////////////////////////////////////////////////////

MATH_TYPE fpoint::law_of_cosines (const fpoint &p1,
const fpoint &p2, const fpoint &p3)
{
    MATH_TYPE A,bc,a2,b2,c2;
    MATH_TYPE dx1,dy1,dx2,dy2,dx3,dy3;
    MATH_TYPE result;
    dx1 = p2.x-p3.x;
    dy1 = p2.y-p3.y;
    a2 = (dx1dx1)+(dy1dy1);
    dx2 = p1.x-p2.x;
    dy2 = p1.y-p3.y;
    b2 = (dx2dx2)+(dy2dy2);
    dx3 = p1.x-p3.x;
    dy3 = p1.y-p3.y;
    c2 = (dx3dx3)+(dy3dy3);
    bc = sqrt(b2c2);
    result = (b2+c2-a2)/(2bc);
    return result;
}

 Well, here it is, therefore, in all of its glory - as we saw earlier, at least one method for subdividing triangles must be lurking somewhere, and by invoking such a process more or less recursively, we might want to consider how this can be extended to perhaps offer at least one way of generating the point cloud for a full head of hair, or a field of grass, or whatever else might come to the imagination.  Solar flares anyone?

What else might you be expecting? And then along came a spider, maybe?  That also seems doable!  There are so many different ways to build our model space, and not just with triangles or quads.  It might also be as if a web or a mesh might represent something else altogether, just like the fabric of space-time itself. This thought is so deep and so perfect, that when we contemplate the meaning of it - the perfect entanglement that is, in some other realm.

WARNING:  While the law of cosines method that I have described here seems to work most of the time, that is for most well-behaved triangles in the first quadrant, some tringles with obtuse angles. or other issues seem to give incorrect results, such as returning angle bisectors that are perpendicular to the correct angles.   In the meantime, have fun with this if you dare, since what I want to do with it is figure out a way to generate the bisectors, as well as do a bunch of other constructions, where feasible that is, without requiring any branches in the code!  And THAT is not at all as simple as it might seem when having to not only contemplate quadrant issues, obtuseness, rotations, etc.  Nonetheless, for purposes of CUDA style or OpenMP style parallelism, and/or pipelining, the more useful work that can be done without needing to have conditional logic, obviously should produce a substantial benefit when the problem at hand is put to scale, regardless of architecture.

Discussions