Skip to content

Commit

Permalink
Renamed myfile.h to File.h
Browse files Browse the repository at this point in the history
  • Loading branch information
krishauser committed Dec 13, 2018
1 parent 4f3e9e5 commit 292bff3
Show file tree
Hide file tree
Showing 26 changed files with 93 additions and 110 deletions.
6 changes: 3 additions & 3 deletions myfile.cpp → File.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <KrisLibrary/Logger.h>
#include "myfile.h"
#include "File.h"
#include "utils.h"
#include "errors.h"
#include <stdlib.h>
Expand All @@ -9,8 +9,8 @@
#include <assert.h>
#include <errno.h>

#include <utils/socketutils.h>
#include <utils/threadutils.h>
#include <KrisLibrary/utils/socketutils.h>
#include <KrisLibrary/utils/threadutils.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion myfile.h → File.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class File
FileImpl* impl;
};

/** \file myfile.h
/** \file File.h
* \ingroup Standard
* \brief A unified interface for reading/writing binary data to file.
*
Expand Down
2 changes: 1 addition & 1 deletion GLdraw/GeometryAppearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <meshing/VolumeGrid.h>
#include <meshing/Expand.h>
#include <geometry/Conversions.h>
#include "Timer.h"
#include <KrisLibrary/Timer.h>

using namespace Geometry;

Expand Down
145 changes: 64 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
KrisLibrary
===========
# KrisLibrary

Basic C++ math, geometry, robotics, and other routines used in projects
from Kris Hauser's lab.
Expand All @@ -8,103 +7,86 @@ Authors:
- Kris Hauser (kris.hauser@duke.edu)


********************************************************************
* Building
********************************************************************
## Building


Requirements
- C++11: support needed in your compiler
- CMake: needed to configure and build KrisLibrary
- Log4CXX: needed for the logging functionality
- OpenGL

Optional
- GLUT / GLUI: for OpenGL visualization
- GLUT / GLUI: needed to open KrisLibrary GLdraw/GLUT* or GLdraw/GLUI* visualization windows
- GLPK: needed for optimization and contact mechanics.
- Tinyxml: needed for Xml resource loading.
- GSL (disabled by default): needed only if you plan to use the special
functions in math/misc.h.
- Assimp (disabled by default): needed only for extra triangle mesh
file format loading.
- GSL: needed for the special functions in math/misc.h.
- Assimp: for extra triangle mesh file format loading.
- BLAS/LAPACK (disabled by default): needed only for the experimental
BLAS and LAPACK interfaces through CLAPACK.
- Log4CXX: for custom logging functionality
- FreeImage: needed for extra image file format loading (JPG,PNG,TIF,GIF, etc)
- OMPL: interfaces to the Open Motion Planning Library. (Note: only works with an old verison)

To build, run:

cmake .
make
> cmake .
> make
or for debug information, run

cmake . -DCMAKE_BUILD_TYPE=debug
make
> cmake . -DCMAKE_BUILD_TYPE=debug
> make
If you observe any packages not identified in the first step, run "cmake-gui ."
to potentially set the appropriate paths manually. Let us know if you have
trouble on your system.


********************************************************************
* Packages
********************************************************************
. structs - useful data structures
. utils - assorted utilites
. math - a large general-purpose math library
. math3d - 2d/3d math library
. geometry - several computational geometry routines (e.g. convex hull)
. optimization - convex/nonconvex optimization routines / interfaces
. GLdraw - OpenGL wrappers and utilities
. graph - template graph library
. camera - projective geometry for cameras in a 3d world
. image - basic image loading/saving
. meshing - triangle mesh structures
. statistics - basic statistics routines
. robotics - robot kinematics, dynamics, and contact mechanics
. planning - motion planning
. spline - splines

********************************************************************
* Known "cruft"
********************************************************************
- myfile should be renamed.
- the 2D libs in math3d are not quite as complete as the 3D libs
- optimization/LCP is a poor quality implementation.
- optimization/MinNormProblem does not have access to a good quadratic
## Packages

* [main folder] - basic things (error reporting, unified binary file/stream/socket I/O class, safe deletion, and timer)
* structs - useful data structures
* utils - assorted utilites
* math - a large general-purpose math library
* math3d - 2d/3d math library
* geometry - several computational geometry routines (e.g. convex hull)
* optimization - convex/nonconvex optimization routines / interfaces
* GLdraw - OpenGL wrappers and utilities
* graph - template graph library
* camera - projective geometry for cameras in a 3d world
* image - basic image loading/saving
* meshing - triangle mesh structures
* statistics - basic statistics routines
* robotics - robot kinematics, dynamics, and contact mechanics
* planning - motion planning
* spline - splines

## Known "cruft"

* The 2D libs in math3d are not quite as complete as the 3D libs
* optimization/LCP is a poor quality implementation.
* optimization/MinNormProblem does not have access to a good quadratic
programming solver.
* The camera/ package is pretty non-conformant with the overall style.
* The GLdraw/ package is capitalized, which is non-conformant
* Image saving is very, very basic at the moment.
* Eventually everything should be placed in a unified namespace.
* Latest version of OMPL should be supported.


********************************************************************
* Contribution guidelines
********************************************************************
## Contribution guidelines

We welcome fixes and contributions to KrisLibrary. Please follow these
guidelines when adding to the library.

Classes should be named as precisely as possible to minimize confusion.

Comment any confusing code. Document using doxygen. Write notes like "TODO"
or "HACK" for partially complete code.

Use STL whenever possible. It keeps things standardized and fairly portable.


Structures vs. Algorithms

Data structure classes should be very reusable. Basic primitive methods should be included, but the class should not contain complex algorithms. For example, a LinearProgram does not contain any information about how to solve it.

Algorithms should be implemented as either functions or external operator classes (latter preferred for complex algorithms -- this allows greater flexibility in defining algorithm parameters, options, control flow, etc).
There are 3 phases in an operator class A: initialization, calculation, and result output.
Initialization could be in a constructor "A a(input)" or an initializer "a.Initialize(input)" or simultaneously with calculation "a.Calculate(input)". This could also includes setting options, perhaps by directly setting member variables.
The output could either be output as an argument to the calculation method "a.Calculate(input,result)" or a member variable in the operator "a.result".
- C++11 is now officially supported. Use STL whenever possible. It keeps things standardized and fairly portable.

- Classes should be named as precisely as possible to minimize confusion.

- Comment any confusing code. Document using doxygen.


****************************************************************************
****************************************************************************

File Formatting:
### File Formatting

Encapsulate the file with the standard #ifndef CATEGORY_FILENAME_H ... #endif
where CATEGORY is the folder name, FILENAME is the file name, translated into
Expand All @@ -115,40 +97,41 @@ commands) should be enclosed in a namespace. Only use `using namespace'
in .h files if it's enclosed in a namespace (e.g. Math3D inherits the
Math namespace).

****************************************************************************

Class Formatting:
### Class Formatting

3 main types of classes
Type 1 is mainly primitive objects
Type 2 is higher-level classes
Type 3 is sloppy objects that don't fall into the prev 2 types. These should eventually be eliminated.

classes are always capitalized (e.g. ClassName).
methods are:
Type 1. start with lowercase, subsequent words capitalized e.g. myFunction
Type 2. Capitalized
member variables are always lowercase.
* Type 1: mainly primitive objects
* Type 2: higher-level classes
* Type 3: sloppy objects that don't fall into the prev 2 types. These should eventually be eliminated.

Classes are always capitalized (e.g. ClassName).

Methods are:
* Type 1. camel-case e.g. myFunction
* Type 2. Capitalized

****************************************************************************
Member variables are always lowercase.

Global Formatting:
### Global Formatting:

Non-inlined functions are always capitalized. Inlined functions may be
lowercase (usually reserved for very primitive operations, like dot products).
Macros are either all caps or capitalized.
Variables are lowercase.


****************************************************************************

Serialization
### Serialization

Whenever possible, objects should be able to be loaded from/saved to disk
using the << and >> operators of the standard iostream objects. For
binary I/O, you can implement the WriteFile(object,File&) and
ReadFile(object,File&) methods.

****************************************************************************

## History

* 12/14/2018 (Latest version): upgraded to take out Boost dependencies, officially using C++11, optional LOG4CXX support, bug fixes.


... there is a very long and undocumented history with this package
2 changes: 1 addition & 1 deletion image/image.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <KrisLibrary/Logger.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <KrisLibrary/utils.h>
#include <KrisLibrary/errors.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion math/LinearPath.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <KrisLibrary/Logger.h>
#include "LinearPath.h"
#include "metric.h"
#include <myfile.h>
#include <File.h>
#include <algorithm>
#include <errors.h>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion math/MatrixTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "MatrixTemplate.h"
#include "fastarray.h"
#include "complex.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <iostream>
#include <errors.h>
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion math/VectorTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "VectorTemplate.h"
#include "fastarray.h"
#include "complex.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <KrisLibrary/errors.h>
#include <iostream>
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion math/complex.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "complex.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <iostream>

namespace Math {
Expand Down
2 changes: 1 addition & 1 deletion math3d/AABB2D.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "AABB2D.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <algorithm>
using namespace Math3D;

Expand Down
2 changes: 1 addition & 1 deletion math3d/AABB3D.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "AABB3D.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <iostream>
using namespace Math3D;
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion math3d/AABBTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define MATH3D_AABB_TEMPLATE_H

#include <KrisLibrary/math/math.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>

namespace Math3D {

Expand Down
2 changes: 1 addition & 1 deletion math3d/Circle3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "geometry3d.h"
#include "misc.h"
#include <KrisLibrary/math/misc.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
using namespace std;
using namespace Math3D;

Expand Down
2 changes: 1 addition & 1 deletion math3d/Plane3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "Plane3D.h"
#include "geometry3d.h"
#include "LinearlyDependent.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <iostream>
#include <errors.h>
using namespace Math3D;
Expand Down
2 changes: 1 addition & 1 deletion math3d/Segment3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "geometry3d.h"
#include "clip.h"
#include "interpolate.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
using namespace Math3D;
using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion math3d/geometry2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "misc.h"
#include <KrisLibrary/math/misc.h>
#include <KrisLibrary/math/Interval.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include "LinearlyDependent.h"
#include "interpolate.h"
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion math3d/geometry3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <iostream>
#include <KrisLibrary/meshing/TriMesh.h>
#include <KrisLibrary/math/misc.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <string>
using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion math3d/primitives.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <KrisLibrary/Logger.h>
#include "primitives.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <iostream>

namespace Math3D {
Expand Down
2 changes: 1 addition & 1 deletion spline/PiecewisePolynomial.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <KrisLibrary/Logger.h>
#include "PiecewisePolynomial.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion spline/spline.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "spline.h"
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>
#include <KrisLibrary/math/complex.h>
#include <assert.h>

Expand Down
2 changes: 1 addition & 1 deletion structs/SparseArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <map>
#include <assert.h>
#include <KrisLibrary/myfile.h>
#include <KrisLibrary/File.h>

/** @brief A sparse 1D array class.
*
Expand Down
Loading

0 comments on commit 292bff3

Please sign in to comment.