davideberly / GeometricTools

A collection of source code for computing in the fields of mathematics, geometry, graphics, image analysis and physics.
Boost Software License 1.0
1.08k stars 202 forks source link

Rename Math.h to GTEMath.h #45

Closed Nosenzor closed 1 year ago

Nosenzor commented 1 year ago

I suggest to rename GTE/Mathematics/Math.h to GTE/Mathematics/GTEMath.h because some system confuse your Math.h wit and leads to errors (at least on MacOS). BTW Your library (very pedagogic and quite simple to use). If you have time I would suggest to allow a separate use of only Mathematics which is by far the most portable part of your library.

davideberly commented 1 year ago

In my code base I have include statements of the form <Mathematics/Math.h>. And I have the include search path using the environment variable GTE_PATH that expands to <somepath/GeometricTools/GTE>, where 'somepath' depends on where you install the root folder 'GeometricTools'. Of course you have to define GTE_PATH in your environment.

With this design, there should be no conflict between <Mathematics/Math.h> and . Even so, MacOS is built on top of Unix where the file names are case sensitive, so it is not clear to me why there would be a conflict between my upper-case Math and the lower-case math. Perhaps you can explain how you are include-ing files in your own code. I recommend that you use the GTE_PATH environment variable and include GTE files the way my distribution does.

Regarding "separate use of only Mathematics", I wrote the GTMathematics projects to have only header files, so you should be able to use only the mathematics portion. That is, GTMathematics files have no dependency on other libraries in my distribution. If you believe there is a dependency, would you mind telling me what that is?

Thank you.

davideberly commented 1 year ago

No response from issue originator, so closing the issue. The header system that GTE uses should prevent any filename clashes in client applications.

Nosenzor commented 1 year ago

Sorry David, I switched to another topic in the meanwhile. Thanks for your answer. FYI, I'm now using again GTE/Mathematics ... on windows this time and I'm getting the same issue. Renaming the Math.h to GTEMath.h (and calling includes) fix the issue. Although being an UNIX-based system, macOS don't have the case sensitive file system enabled by default (and of course Windows is not case sensitive too) I'm not setting GTE_PATH as you recommended, so you don't need to reopen the issue ;-)

image
davideberly commented 1 year ago

When I supported Macintosh OS X a long time ago, I thought the file system at that time was case sensitive. I guess that has changed. I am not surprised. I gave up on OS X when Carbon was deprecated, GLUT was deprecated, OpenGL was deprecated, you could no longer use C functions to read environment variables, you had to use Cocoa, and you had to use Metal. And Objective C is the language of choice, not C++. I prefer focusing on algorithm development. I do not have time to do things the Apple Way.

The GTE distribution has compiled without errors on Windows machines. I will assume that you are also not setting the environment variable GTE_PATH on Windows. Even so, I still do not understand what you are doing. For example, my Vector.h file has

    #include <Mathematics/Math.h>

This requires that the compiler know where the "Mathematics" folder is located. How it is possible to have a name conflict between and <Mathematics/Math.h>, with or without case sensitivity? My guess is that you are using only my Math.h via

    #include <Math.h> or #include "Math.h"

But then you should get a massive number of errors if you try to compile other GTE files that include <Mathematics/Math.h>

The GTL development track does not have a Math.h file, but the header files use the format <GTL/some_path/some_file.h>. This still requires the compiler to locate the GTL folder, which I do using an environment variable GTL_PATH (the parent folder for GTL). Also, there is a separate library for only the mathematics code. The header include paths are <GTL/Mathematics/some_subpath/some_file.h>. Graphics code, for example, has header files included via <GTL/Graphics/some_subpath/some_file.h>.