├── COPYING ├── INSTALL ├── NEWS ├── stamp-h ├── .gitignore ├── include ├── stamp-h ├── stamp-h.in ├── stamp-h1 ├── Makefile.am ├── plib_config.h.vc └── plib.h ├── examples ├── matrix │ ├── .deps │ │ ├── terr.Po │ │ ├── tmatrix.Po │ │ └── tvqSort.Po │ ├── terr.cpp │ ├── Makefile.am │ ├── tvqSort.cpp │ └── tmatrix.cpp ├── nurbs │ ├── .deps │ │ ├── tclose.Po │ │ ├── tdrawAa.Po │ │ ├── tleastS.Po │ │ ├── tnurbs.Po │ │ ├── tnurbsS.Po │ │ ├── topengl.Po │ │ ├── thnurbsS.Po │ │ ├── tmatrixRT.Po │ │ ├── tmeasures.Po │ │ ├── tnApprox.Po │ │ ├── tnInterp.Po │ │ ├── tnMovePoint.Po │ │ ├── tnlength.Po │ │ ├── tnsMovePoint.Po │ │ ├── tnsSweep.Po │ │ ├── tnurbsS_sp.Po │ │ ├── tnurbsSub.Po │ │ ├── tnurbs_sp.Po │ │ └── trispline.Po │ ├── tleastS.png │ ├── tmatrixRT.cpp │ ├── tleastS.cpp │ ├── tdrawAa.cpp │ ├── tmeasures.cpp │ ├── tnurbsS_sp.cpp │ ├── tnurbs_sp.cpp │ ├── Makefile.am │ ├── tnsSweep.cpp │ ├── tnurbsSub.cpp │ ├── tnurbs.cpp │ ├── tnInterp.cpp │ ├── tnurbsS.cpp │ ├── tnsMovePoint.cpp │ ├── tclose.cpp │ └── trispline.cpp ├── image │ ├── .deps │ │ └── randomImg.Po │ ├── Makefile.am │ └── randomImg.cpp ├── numerical │ ├── .deps │ │ ├── tint.Po │ │ ├── tint2.Po │ │ ├── tmatrixMat.Po │ │ └── tstatistics.Po │ ├── Makefile.am │ ├── tint.cpp │ ├── tstatistics.cpp │ ├── tint2.cpp │ └── tmatrixMat.cpp ├── Makefile.am └── vc6 │ └── numericlib │ └── numericlib.dsp ├── tests ├── matrix │ ├── .deps │ │ ├── test_main.Po │ │ ├── test_barray2d.Po │ │ └── test_matrix.Po │ ├── Makefile.am │ └── test_main.cpp ├── nurbs │ ├── .deps │ │ ├── test_main.Po │ │ └── test_nurbs.Po │ ├── Makefile.am │ └── test_main.cpp └── Makefile.am ├── config ├── libtool.m4 ├── ltsugar.m4 ├── ltoptions.m4 ├── ltversion.m4 ├── lt~obsolete.m4 ├── Makefile.am ├── plib_extra.m4 ├── has_image_magick.m4 └── has_cppunit.m4 ├── ltmain.sh ├── image ├── .DS_Store ├── Makefile.am ├── color.cpp.rej ├── rec_filter_.cpp ├── filter.h └── filter_.cpp ├── nurbs ├── nurbs.cpp ├── nurbsS.h ├── nurbsS.cpp ├── f_hnurbsS.cpp ├── d_hnurbsS.cpp ├── d_hnurbsS_sp.cpp ├── f_hnurbsS_sp.cpp ├── d_nurbs_sp.cpp ├── f_nurbsS_sp.cpp ├── d_curve.cpp ├── d_nurbsS_sp.cpp ├── f_curve.cpp ├── f_nurbs_sp.cpp ├── d_nurbsArray.cpp ├── f_nurbsArray.cpp ├── d_tri_spline.cpp ├── f_tri_spline.cpp ├── f_nurbsS.cpp ├── f_surface.cpp ├── d_nurbsS.cpp ├── d_surface.cpp ├── Makefile.am ├── tri_spline.h └── hnurbs.h ├── matrix ├── .DS_Store ├── barray2d_uchar.cpp.rej ├── barray_complex.cpp.rej ├── vector_int.cpp.rej ├── vector_float.cpp.rej ├── matrix_complex.cpp.rej ├── matrix_float.cpp.rej ├── matrix_double.cpp.rej ├── vector_double.cpp.rej ├── barray_void.cpp ├── vector.h.rej ├── cvector.h.rej ├── matrixTool.cpp ├── matrix_char.cpp.rej ├── specialType.h ├── Makefile.am ├── matrix_hpoint.cpp.rej ├── matrix_uchar.cpp.rej ├── matrix_point.cpp.rej ├── coordinate.cpp ├── matrix_int.cpp.rej ├── barray2d_int.cpp ├── barray2d_char.cpp ├── barray2d_float.cpp ├── barray2d_double.cpp ├── point_nd.cpp ├── barray2d_complex.cpp ├── hpoint_nd.cpp ├── barray_int.cpp ├── barray2d_coordinate.cpp ├── barray_char.cpp ├── barray_float.cpp ├── barray_double.cpp ├── cvector.cpp ├── barray_coordinate.cpp ├── barray_uchar.cpp ├── vector_char.cpp ├── vector_int.cpp ├── vector_int.cpp.orig ├── vector_uchar.cpp ├── vector_float.cpp ├── vector_float.cpp.orig ├── vector_double.cpp ├── vector_double.cpp.orig ├── matrix_float.cpp ├── matrix_float.cpp.orig ├── matrix_double.cpp ├── matrix_double.cpp.orig ├── barray_complex.cpp ├── barray_complex.cpp.orig ├── barray2d_uchar.cpp ├── barray2d_uchar.cpp.orig ├── list.cpp ├── matrix_global.h ├── cvector.h ├── cvector.h.orig ├── barray2d_point.cpp └── barray_point.cpp ├── numerical ├── .DS_Store ├── Makefile.am ├── chebexp_.cpp ├── fft_.cpp ├── matrixMat_.cpp ├── integrate.h ├── statistic.h └── statistic_.cpp ├── config_mvc.bat ├── README ├── nurbs++-3.0.12.pc.in ├── nurbs++-3.0.12.pc ├── AUTHORS ├── Makefile.am ├── mkinstalldirs ├── acconfig.h ├── nurbs++-config.in ├── nurbs++-config └── nurbs++-config.1 /COPYING: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /stamp-h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *~ -------------------------------------------------------------------------------- /include/stamp-h: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /include/stamp-h.in: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /examples/matrix/.deps/terr.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tclose.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tdrawAa.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tleastS.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnurbs.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnurbsS.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/topengl.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /tests/matrix/.deps/test_main.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /tests/nurbs/.deps/test_main.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /tests/nurbs/.deps/test_nurbs.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /config/libtool.m4: -------------------------------------------------------------------------------- 1 | /usr/share/aclocal/libtool.m4 -------------------------------------------------------------------------------- /config/ltsugar.m4: -------------------------------------------------------------------------------- 1 | /usr/share/aclocal/ltsugar.m4 -------------------------------------------------------------------------------- /examples/image/.deps/randomImg.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/matrix/.deps/tmatrix.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/matrix/.deps/tvqSort.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/numerical/.deps/tint.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/numerical/.deps/tint2.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/thnurbsS.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tmatrixRT.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tmeasures.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnApprox.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnInterp.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnMovePoint.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnlength.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnsMovePoint.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnsSweep.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnurbsS_sp.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnurbsSub.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/tnurbs_sp.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/nurbs/.deps/trispline.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /ltmain.sh: -------------------------------------------------------------------------------- 1 | /usr/share/libtool/config/ltmain.sh -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS= matrix nurbs 2 | 3 | -------------------------------------------------------------------------------- /tests/matrix/.deps/test_barray2d.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /tests/matrix/.deps/test_matrix.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /config/ltoptions.m4: -------------------------------------------------------------------------------- 1 | /usr/share/aclocal/ltoptions.m4 -------------------------------------------------------------------------------- /config/ltversion.m4: -------------------------------------------------------------------------------- 1 | /usr/share/aclocal/ltversion.m4 -------------------------------------------------------------------------------- /examples/numerical/.deps/tmatrixMat.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /examples/numerical/.deps/tstatistics.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /config/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | /usr/share/aclocal/lt~obsolete.m4 -------------------------------------------------------------------------------- /include/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for include/plib_config.h 2 | -------------------------------------------------------------------------------- /image/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/image/.DS_Store -------------------------------------------------------------------------------- /nurbs/nurbs.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/nurbs/nurbs.cpp -------------------------------------------------------------------------------- /nurbs/nurbsS.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/nurbs/nurbsS.h -------------------------------------------------------------------------------- /matrix/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/matrix/.DS_Store -------------------------------------------------------------------------------- /nurbs/nurbsS.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/nurbs/nurbsS.cpp -------------------------------------------------------------------------------- /numerical/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/numerical/.DS_Store -------------------------------------------------------------------------------- /examples/nurbs/tleastS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisidefix/nurbs/HEAD/examples/nurbs/tleastS.png -------------------------------------------------------------------------------- /config_mvc.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd . 3 | cd include 4 | copy plib_config.h.vc plib_config.h 5 | popd 6 | @echo on 7 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS= matrix numerical image nurbs 2 | #DIST_SUBDIRS = matrix numerical image nurbs 3 | 4 | 5 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = plib_config.h.in stamp-h.in stamp-h plib_config.h.vc 2 | pkginclude_HEADERS = plib_config.h plib.h 3 | -------------------------------------------------------------------------------- /config/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = cxx_features.m4 \ 2 | has_cppunit.m4 \ 3 | has_image_magick.m4 \ 4 | has_opengl.m4 \ 5 | plib_extra.m4 6 | -------------------------------------------------------------------------------- /nurbs/f_hnurbsS.cpp: -------------------------------------------------------------------------------- 1 | #include "hnurbsS.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | template class HNurbsSurface ; 7 | #endif 8 | 9 | } 10 | -------------------------------------------------------------------------------- /nurbs/d_hnurbsS.cpp: -------------------------------------------------------------------------------- 1 | #include "hnurbsS.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | template class HNurbsSurface ; 7 | #endif 8 | 9 | } 10 | -------------------------------------------------------------------------------- /nurbs/d_hnurbsS_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "hnurbsS_sp.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | template class HNurbsSurfaceSP ; 7 | #endif 8 | 9 | } 10 | -------------------------------------------------------------------------------- /nurbs/f_hnurbsS_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "hnurbsS_sp.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | template class HNurbsSurfaceSP ; 7 | #endif 8 | 9 | } 10 | -------------------------------------------------------------------------------- /nurbs/d_nurbs_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbs_sp.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class NurbsCurveSP ; 8 | 9 | #endif 10 | 11 | } 12 | -------------------------------------------------------------------------------- /nurbs/f_nurbsS_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsS_sp.cpp" 2 | 3 | 4 | namespace PLib { 5 | 6 | #ifdef NO_IMPLICIT_TEMPLATES 7 | 8 | template class NurbsSurfaceSP ; 9 | 10 | #endif 11 | 12 | } 13 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the NURBS++ library a library to manipulate and create NURBS curves 2 | and surfaces. 3 | 4 | The information about the library are available from the website at 5 | https://launchpad.net/nurbs++/ 6 | -------------------------------------------------------------------------------- /nurbs/d_curve.cpp: -------------------------------------------------------------------------------- 1 | #include "curve.cpp" 2 | 3 | namespace PLib { 4 | #ifdef NO_IMPLICIT_TEMPLATES 5 | template class ParaCurve ; 6 | template class ParaCurve ; 7 | #endif 8 | } 9 | 10 | -------------------------------------------------------------------------------- /nurbs/d_nurbsS_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsS_sp.cpp" 2 | 3 | 4 | 5 | 6 | namespace PLib { 7 | 8 | #ifdef NO_IMPLICIT_TEMPLATES 9 | 10 | template class NurbsSurfaceSP ; 11 | 12 | #endif 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nurbs/f_curve.cpp: -------------------------------------------------------------------------------- 1 | #include "curve.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class ParaCurve ; 8 | template class ParaCurve ; 9 | 10 | #endif 11 | 12 | } 13 | -------------------------------------------------------------------------------- /nurbs/f_nurbs_sp.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbs_sp.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class NurbsCurveSP ; 8 | template class NurbsCurveSP ; 9 | 10 | #endif 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /nurbs/d_nurbsArray.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsArray.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class NurbsCurveArray ; 8 | template class NurbsSurfaceArray ; 9 | 10 | template class NurbsCurveArray ; 11 | 12 | #endif 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nurbs/f_nurbsArray.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsArray.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class NurbsCurveArray ; 8 | template class NurbsSurfaceArray ; 9 | 10 | template class NurbsCurveArray ; 11 | 12 | #endif 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nurbs++-3.0.12.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: NURBS++ 7 | Description: NURBS++ library 8 | Requires: 9 | Version: 3.0.12 10 | Libs: -L${libdir} -lnurbsf -lmatrixN -lmatrixI -lmatrix 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /nurbs++-3.0.12.pc: -------------------------------------------------------------------------------- 1 | prefix=/NOBACKUP/smakadir/nurbs++/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: NURBS++ 7 | Description: NURBS++ library 8 | Requires: 9 | Version: 3.0.12 10 | Libs: -L${libdir} -lnurbsf -lmatrixN -lmatrixI -lmatrix 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /matrix/barray2d_uchar.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - ostream& 7 | Basic2DArray::print(ostream& os) const 8 | { 9 | int i, j; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> ostream& 15 | Basic2DArray::print(ostream& os) const 16 | { 17 | int i, j; 18 | -------------------------------------------------------------------------------- /nurbs/d_tri_spline.cpp: -------------------------------------------------------------------------------- 1 | #include "tri_spline.cpp" 2 | 3 | namespace PLib { 4 | 5 | 6 | #ifdef NO_IMPLICIT_TEMPLATES 7 | template class TriangularBSpline ; 8 | template class RTriangularBSpline ; 9 | 10 | template void convert(const NurbsSurface& surf, RTriangularBSpline &t1, RTriangularBSpline &t2); 11 | 12 | #endif 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nurbs/f_tri_spline.cpp: -------------------------------------------------------------------------------- 1 | #include "tri_spline.cpp" 2 | 3 | namespace PLib { 4 | 5 | 6 | #ifdef NO_IMPLICIT_TEMPLATES 7 | 8 | template class TriangularBSpline ; 9 | template class RTriangularBSpline ; 10 | 11 | template void convert(const NurbsSurface& surf, RTriangularBSpline &t1, RTriangularBSpline &t2); 12 | 13 | #endif 14 | 15 | } 16 | -------------------------------------------------------------------------------- /matrix/barray_complex.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - ostream& 7 | BasicArray::print(ostream& os) const{ 8 | const int iend = size(); 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> ostream& 15 | BasicArray::print(ostream& os) const{ 16 | const int iend = size(); 17 | 18 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Main author: 2 | Philippe Lavoie 1996-2002 3 | 4 | The following people have made contributions to NURBS++: 5 | Alejandro F Frangi 1996-2002 6 | Ashraful Kadir 2008-2010 7 | Jacques Leroy 1996-2002 8 | Martin Schuerch 1996-2002 9 | -------------------------------------------------------------------------------- /matrix/vector_int.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - void Vector::qSortStd(){ 7 | qsort((char*)memory(),n(),sizeof(int),compareInt) ; 8 | } 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> void Vector::qSortStd(){ 15 | qsort((char*)memory(),n(),sizeof(int),compareInt) ; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /numerical/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = matrixMat.cpp fft.cpp chebexp.cpp intccq.cpp statistic.cpp 2 | 3 | pkginclude_HEADERS = matrixMat.h integrate.h statistic.h 4 | 5 | INCLUDES = -I@top_srcdir@/include -I@top_srcdir@/matrix 6 | 7 | lib_LTLIBRARIES = libmatrixN.la 8 | libmatrixN_la_SOURCES = matrixMat_.cpp fft_.cpp chebexp_.cpp intccq_.cpp statistic_.cpp 9 | libmatrixN_la_LDFLAGS = -version-info 1:0:0 10 | 11 | -------------------------------------------------------------------------------- /examples/matrix/terr.cpp: -------------------------------------------------------------------------------- 1 | #include "vector.h" 2 | 3 | int main(){ 4 | PLib::Vector V(100) ; 5 | 6 | int i= 0 ; 7 | #ifdef USE_EXCEPTION 8 | try{ 9 | for(;;++i){ 10 | V[i] = 0 ; 11 | } 12 | } 13 | catch(PLib::MatrixErr&){ 14 | cerr << "An error occured\n" ; 15 | } 16 | #else 17 | for(;;++i){ 18 | V[i] = 0 ; 19 | } 20 | #endif 21 | 22 | return 0 ; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /matrix/vector_float.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - void Vector::qSortStd(){ 7 | qsort((char*)memory(),n(),sizeof(float),compareFloat) ; 8 | } 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> void Vector::qSortStd(){ 15 | qsort((char*)memory(),n(),sizeof(float),compareFloat) ; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /matrix/matrix_complex.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - double Matrix::norm(void){ 7 | int i,j ; 8 | double sumR, sumI, maxsum; 9 | int init=0 ; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> double Matrix::norm(void){ 15 | int i,j ; 16 | double sumR, sumI, maxsum; 17 | int init=0 ; 18 | -------------------------------------------------------------------------------- /matrix/matrix_float.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - void Matrix::qSort(){ 7 | qsort((char*)m,rows()*cols(),sizeof(float),compareFloat) ; 8 | } 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> void Matrix::qSort(){ 15 | qsort((char*)m,rows()*cols(),sizeof(float),compareFloat) ; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /matrix/matrix_double.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - void Matrix::qSort(){ 7 | qsort((char*)m,rows()*cols(),sizeof(double),compareDouble) ; 8 | } 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> void Matrix::qSort(){ 15 | qsort((char*)m,rows()*cols(),sizeof(double),compareDouble) ; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /matrix/vector_double.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - void Vector::qSortStd(){ 7 | qsort((char*)memory(),n(),sizeof(float),compareDouble) ; 8 | } 9 | 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> void Vector::qSortStd(){ 15 | qsort((char*)memory(),n(),sizeof(float),compareDouble) ; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /examples/matrix/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | COMPLEXLIB = @complex_lib@ 3 | 4 | INCLUDES = -I@top_srcdir@/matrix 5 | #LIBSINC = $(MAGICK_LIB) 6 | 7 | EXTRALIBS = -lm -lc 8 | ALLLIBS = $(EXTRALIBS) 9 | 10 | TESTS = tvqSort tmatrix 11 | noinst_PROGRAMS = tvqSort tmatrix terr 12 | LDADD = ../../matrix/libmatrix.la $(ALLLIBS) 13 | #LDFLAGS = $(LIBSINC) 14 | 15 | tvqSort_SOURCES = tvqSort.cpp 16 | tmatrix_SOURCES = tmatrix.cpp 17 | terr_SOURCES = terr.cpp 18 | -------------------------------------------------------------------------------- /tests/matrix/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = Matrix.dsp 2 | 3 | INCLUDES = @CPPUNIT_CPPFLAGS@ -I@top_srcdir@/matrix -I@top_srcdir@/include 4 | LDADD = @CPPUNIT_LIBS@ -ldl @top_srcdir@/matrix/libmatrix.la -lm -lc 5 | 6 | if BUILD_CPPUNIT_TESTS 7 | test_program = test_matrix 8 | else 9 | test_program = 10 | endif 11 | 12 | noinst_PROGRAMS = $(test_program) 13 | 14 | test_matrix_SOURCES = test_main.cpp test_matrix.cpp test_barray2d.cpp 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /image/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = rec_filter.cpp filter.cpp image.cpp 2 | 3 | MAGICK_INCLUDE = @MAGICK_CPPFLAGS@ 4 | INCLUDES = $(MAGICK_INCLUDE) -I@top_srcdir@/include -I@top_srcdir@/matrix 5 | 6 | AM_CXXFLAGS = @CXXFLAGS@ 7 | 8 | pkginclude_HEADERS = image.h rec_filter.h color.h filter.h 9 | 10 | lib_LTLIBRARIES = libmatrixI.la 11 | libmatrixI_la_SOURCES = color.cpp image_.cpp rec_filter_.cpp filter_.cpp 12 | libmatrixI_la_LDFLAGS = -version-info 1:0:0 13 | -------------------------------------------------------------------------------- /examples/numerical/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | COMPLEXLIB = @complex_lib@ 3 | 4 | INCLUDES = -I@top_srcdir@/matrix -I@top_srcdir@/numerical 5 | 6 | EXTRALIBS = -lm -lc 7 | ALLLIBS = $(EXTRALIBS) 8 | 9 | TESTS = tmatrixMat tint tint2 tstatistics 10 | noinst_PROGRAMS = tmatrixMat tint tint2 tstatistics 11 | LDADD = ../../numerical/libmatrixN.la ../../matrix/libmatrix.la $(ALLLIBS) 12 | 13 | tmatrixMat_SOURCES = tmatrixMat.cpp 14 | tint_SOURCES = tint.cpp 15 | tint2_SOURCES = tint2.cpp 16 | tstatistics_SOURCES = tstatistics.cpp 17 | -------------------------------------------------------------------------------- /examples/nurbs/tmatrixRT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | Point3Df v(1,1,1) ; 6 | Point3Df w ; 7 | MatrixRT_FLOAT A ; 8 | 9 | cout << "v = " << v << endl ;; 10 | A.rotate(M_PI/2.0,0,0) ; 11 | w = A*v ; 12 | cout << "rotate in x by 90 deg = " << w << endl ; 13 | A.rotate(0,M_PI/2.0,0) ; 14 | w = A*v ; 15 | cout << "rotate in y by 90 deg = " << w << endl ; 16 | A.rotate(0,0,M_PI/2.0) ; 17 | w = A*v ; 18 | cout << "rotate in z by 90 deg = " << w << endl ; 19 | } 20 | -------------------------------------------------------------------------------- /matrix/barray_void.cpp: -------------------------------------------------------------------------------- 1 | #include "barray.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template class BasicArray ; 8 | template void resizeBasicArray(BasicArray&,int) ; 9 | template int operator!=(const BasicArray&,const BasicArray&); 10 | template int operator==(const BasicArray&,const BasicArray&); 11 | //template istream& operator>>(istream& is, BasicArray& ary); 12 | //template ostream& operator<<(ostream& os, const BasicArray& ary); 13 | 14 | #endif 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/image/Makefile.am: -------------------------------------------------------------------------------- 1 | MAGICK_INCLUDE = $(X_CFLAGS) @magick_include@ 2 | MAGICK_LIB = $(X_PRE_LIBS) @magick_lib@ $(X_LIBS) -lXt -lX11 3 | 4 | LAPACKLIBS = @lapack_libs@ 5 | COMPLEXLIB = @complex_lib@ 6 | #MATRIXLIB = @matrix_lib@ 7 | 8 | INCLUDES = $(MAGICK_INCLUDE) -I@top_srcdir@/matrix -I@top_srcdir@/image 9 | LIBSINC = $(MAGICK_LIB) 10 | 11 | EXTRALIBS = -lm -lc 12 | ALLLIBS = @magick_libs@ $(EXTRALIBS) 13 | 14 | noinst_PROGRAMS = randomImg 15 | LDADD = ../../image/libmatrixI.la ../../matrix/libmatrix.la $(ALLLIBS) 16 | AM_LDFLAGS = $(LIBSINC) 17 | 18 | randomImg_SOURCES = randomImg.cpp 19 | -------------------------------------------------------------------------------- /matrix/vector.h.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 69,75 **** 3 | { 4 | public: 5 | int rows() const //!< a reference to the size of the vector 6 | - { return sze ;} 7 | Vector() : BasicArray(1) {} //!< Basic constructor 8 | Vector(const int r) : BasicArray(r) {} 9 | Vector(const Vector& v) : BasicArray(v) {} 10 | --- 69,75 ---- 11 | { 12 | public: 13 | int rows() const //!< a reference to the size of the vector 14 | + { return this->sze ;} 15 | Vector() : BasicArray(1) {} //!< Basic constructor 16 | Vector(const int r) : BasicArray(r) {} 17 | Vector(const Vector& v) : BasicArray(v) {} 18 | -------------------------------------------------------------------------------- /tests/nurbs/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = nurbs.dsp 2 | 3 | INCLUDES = -I@top_srcdir@/matrix \ 4 | -I@top_srcdir@/include \ 5 | -I@top_srcdir@/nurbs \ 6 | -I@top_srcdir@/image \ 7 | -I@top_srcdir@/numerical \ 8 | @CPPUNIT_CPPFLAGS@ 9 | 10 | OPENGL_LIBS = @X_LIBS@ @GL_LIBS@ 11 | 12 | LDADD = @CPPUNIT_LIBS@ -ldl @top_srcdir@/matrix/libmatrix.la @top_srcdir@/image/libmatrixI.la @top_srcdir@/numerical/libmatrixN.la @top_srcdir@/nurbs/libnurbsf.la $(OPENGL_LIBS) -lm -lc 13 | 14 | if BUILD_CPPUNIT_TESTS 15 | test_program = test_nurbs 16 | else 17 | test_program = 18 | endif 19 | 20 | noinst_PROGRAMS = $(test_program) 21 | test_nurbs_SOURCES = test_main.cpp test_nurbs.cpp 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/matrix/tvqSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | Vector_INT b(5) ; 5 | Vector_FLOAT c(5) ; 6 | 7 | b[0] = c[0] = 0.4 ; 8 | b[1] = c[1] = 8.9 ; 9 | b[2] = c[2] = 3.5 ; 10 | b[3] = c[3] = 0.2 ; 11 | b[4] = c[4] = 5 ; 12 | 13 | cout << " C = " << c ; 14 | c.qSort() ; 15 | cout << "sorted C = " << c ; 16 | cout << endl ; 17 | cout << " B = " << b ; 18 | b.qSort() ; 19 | cout << "sorted B = " << b ; 20 | 21 | /* 22 | NMatrix::Error error("tvqSort") ; 23 | 24 | cout << "still good ? " << error.opfx() << endl ; 25 | error << "This makes sure the warning system works.\n" ; 26 | error.fatal() ; 27 | */ 28 | return 0 ; 29 | } 30 | -------------------------------------------------------------------------------- /examples/matrix/tmatrix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | using namespace PLib ; 6 | Matrix_FLOAT a(4,4) ; 7 | int i,j ; 8 | 9 | for(i=0;i 4 | #include 5 | 6 | #include "integrate.h" 7 | 8 | using namespace PLib ; 9 | 10 | int nf = 0; 11 | 12 | 13 | struct TestFcn : public ClassPO { 14 | double operator()(double x) 15 | { 16 | nf++; 17 | return 4 / (1 + x * x); 18 | } 19 | int nf ; 20 | TestFcn(): nf(0) {;} 21 | }; 22 | 23 | main() 24 | { 25 | double i, err; 26 | TestFcn f ; 27 | 28 | 29 | // the casting is necessary with g++ and -fno_implicit_templates 30 | i = integrate((ClassPO*)&f, 0.0, 1.0, 1.0e-15, 3200, err); 31 | printf("I= integral_[0,1] 4/(1+x^2) dx\n"); 32 | printf("I= %lg\t err= %lg\t N= %d\n", i, err, f.nf); 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /numerical/chebexp_.cpp: -------------------------------------------------------------------------------- 1 | #include "chebexp.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template void chebexp(double (*f)(float), float a, float b, float eps, BasicArray &c, float &err) ; 8 | template void chebexp(double (*f)(float,void*), void*, float a, float b, float eps, BasicArray &c, float &err) ; 9 | template float chebeval(float x, const BasicArray &c) ; 10 | 11 | template void chebexp(double (*f)(double), double a, double b, double eps, BasicArray &c, double &err) ; 12 | template void chebexp(double (*f)(double,void*), void*, double a, double b, double eps, BasicArray &c, double &err) ; 13 | template double chebeval(double x, const BasicArray &c) ; 14 | 15 | #endif 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = dist-bzip2 dist-zip 2 | ACLOCAL_AMFLAGS = -I config 3 | 4 | SUBDIRS= include matrix numerical image nurbs tests 5 | #EXTRA_SUBDIRS = examples 6 | DIST_SUBDIRS = include matrix numerical image nurbs examples tests config 7 | 8 | bin_SCRIPTS = nurbs++-config 9 | man_MANS = nurbs++-config.1 10 | 11 | EXTRA_DIST = config_mvc.bat \ 12 | nurbs++-config.1 13 | 14 | dist-hook: 15 | cp -pr $(top_srcdir)/examples/vc6 $(distdir)/examples 16 | rm -rf `find $(distdir)/examples -name CVS` 17 | 18 | m4sources = \ 19 | config/has_image_magick.m4 \ 20 | config/has_cppunit.m4 \ 21 | config/has_opengl.m4 22 | 23 | m4datadir = $(datadir)/aclocal 24 | #m4data_DATA = nurbs++.m4 25 | 26 | pkgconfigdir = $(libdir)/pkgconfig 27 | pkgconfig_DATA = nurbs++-3.0.12.pc 28 | 29 | -------------------------------------------------------------------------------- /examples/numerical/tstatistics.cpp: -------------------------------------------------------------------------------- 1 | #include "statistic.h" 2 | #include 3 | 4 | int main(){ 5 | using namespace PLib ; 6 | 7 | 8 | cout << "Testing the statistic package.\n" ; 9 | 10 | initStatistic(); 11 | 12 | int i ; 13 | for(i=0;i<10;++i){ 14 | cout << "!" << i << " = " << factorial(i) << " and ln !" << i << " = " << lnOfFactorial(i) << endl ; 15 | } 16 | 17 | cout << "The error function(0) = " << errorFcn(0) << endl ; 18 | cout << "The error function(0.2) = " << errorFcn(0.2) << endl ; 19 | cout << "The error function(0.5) = " << errorFcn(0.5) << endl ; 20 | cout << "The error function(1.0) = " << errorFcn(1.0) << endl ; 21 | cout << "The error function(2.0) = " << errorFcn(2.0) << endl ; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /examples/nurbs/tleastS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | #ifdef WITH_IMAGE_MAGICK 6 | IM_Image img ; 7 | 8 | if(!img.read("tleastS.png")){ 9 | cout << "Problem reading the tleastS.png image.\n" ; 10 | return 1 ; 11 | } 12 | 13 | Matrix_Point3Df Pts(img.rows(),img.cols()) ; 14 | for(int i=0;i& v) : Vector(v), index(0) {;} 4 | virtual ~CVector() {} 5 | 6 | - T& operator[](const int i) { return x[i%sze]; } 7 | - T operator[](const int i) const { return x[i%sze]; } 8 | 9 | - void put(T v) { x[index] = v ; index = (index+1)%sze; } 10 | 11 | protected: 12 | int index ; 13 | --- 54,63 ---- 14 | CVector(const BasicArray& v) : Vector(v), index(0) {;} 15 | virtual ~CVector() {} 16 | 17 | + T& operator[](const int i) { return this->x[i%this->sze]; } 18 | + T operator[](const int i) const { return this->x[i%this->sze]; } 19 | 20 | + void put(T v) { this->x[index] = v ; index = (index+1)%this->sze; } 21 | 22 | protected: 23 | int index ; 24 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 1.1.1.1 2001/11/02 01:53:23 philosophil Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /config/plib_extra.m4: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl PL_PROG_PERL 3 | dnl 4 | AC_DEFUN(PL_PROG_PERL,[ 5 | perl=`which perl` 6 | AC_MSG_CHECKING(Which perl are you using ?) 7 | AC_MSG_RESULT($perl) 8 | AC_SUBST(perl) 9 | ] 10 | )dnl 11 | 12 | dnl 13 | dnl PL_PROG_PERL 14 | dnl 15 | AC_DEFUN(PL_PROG_SHELL,[ 16 | AC_MSG_CHECKING(Which sh are you using ?) 17 | shell=`which sh` 18 | AC_MSG_RESULT('$shell') 19 | SHELL=$shell 20 | dnl AC_SUBST(shell) 21 | dnl AC_SUBST(SHELL) 22 | ] 23 | )dnl 24 | 25 | dnl 26 | dnl PLIB_INSIDE_MINDSEYE 27 | dnl -------------------- 28 | AC_DEFUN(PLIB_INSIDE_MINDSEYE, 29 | [ 30 | AC_MSG_CHECKING(if the nurbs++ package is used inside MindsEye) 31 | nurbs_tmp=`pwd | sed -e 's%.*MindsEye.*%yes%'` 32 | if test "$nurbs_tmp" = yes ; then 33 | prefix=`cd ..; pwd` 34 | prefix=$prefix'/src' 35 | includedir=$prefix'/include' 36 | AC_SUBST(prefix) 37 | AC_SUBST(includedir) 38 | AC_DEFINE(COLUMN_ORDER) 39 | inside_mindseye=yes 40 | AC_SUBST(inside_mindseye) 41 | AC_MSG_RESULT(yes) 42 | else 43 | AC_MSG_RESULT(no) 44 | fi 45 | ])dnl 46 | -------------------------------------------------------------------------------- /config/has_image_magick.m4: -------------------------------------------------------------------------------- 1 | dnl WITH_IMAGE_MAGICK 2 | dnl 3 | dnl Wheter Image Magick is defined in this system. 4 | AC_DEFUN(WITH_IMAGE_MAGICK, 5 | [ 6 | AC_REQUIRE([AC_PROG_CXX]) 7 | AC_MSG_CHECKING(whether Image Magick's Magick++ library is present) 8 | 9 | AC_CACHE_VAL(has_image_magick, 10 | [ 11 | AC_LANG_SAVE 12 | AC_LANG_CPLUSPLUS 13 | MAGICK_CPPFLAGS=`Magick++-config --cppflags` 14 | MAGICK_LDFLAGS=`Magick++-config --ldflags` 15 | MAGICK_LIBS=`Magick++-config --libs` 16 | SAVE_CPPFLAGS="$CPPFLAGS" 17 | CPPFLAGS="$CPPFLAGS $MAGICK_CPPFLAGS" 18 | SAVE_LDFLAGS="$LDFLAGS" 19 | LDFLAGS="$LDFLAGS $MAGICK_LDFLAGS" 20 | SAVE_LIBS="$LIBS" 21 | LIBS="$LIBS $MAGICK_LIBS" 22 | 23 | AC_TRY_COMPILE([ 24 | #include 25 | ],[return 1;], 26 | has_image_magick=yes, 27 | has_image_magick=no) 28 | 29 | CPPFLAGS="$SAVE_CPPFLAGS" 30 | LDFLAGS="$SAVE_LDFLAGS" 31 | LIBS="$SAVE_LIBS" 32 | AC_LANG_RESTORE 33 | ]) 34 | 35 | AC_MSG_RESULT($has_image_magick) 36 | if test "$has_image_magick" = yes; then 37 | AC_DEFINE(MAGICK_CPPFLAGS) 38 | AC_DEFINE(MAGICK_LDFLAGS) 39 | AC_DEFINE(MAGICK_LIBS) 40 | fi 41 | ]) 42 | 43 | -------------------------------------------------------------------------------- /tests/nurbs/test_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | int 10 | main( int argc, char* argv[] ) 11 | { 12 | // Create the event manager and test controller 13 | CppUnit::TestResult controller; 14 | 15 | // Add a listener that colllects test result 16 | CppUnit::TestResultCollector result; 17 | controller.addListener( &result ); 18 | 19 | // Add a listener that print dots as test run. 20 | CppUnit::BriefTestProgressListener progress; 21 | controller.addListener( &progress ); 22 | 23 | // Add the top suite to the test runner 24 | CppUnit::TestRunner runner; 25 | runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); 26 | runner.run( controller ); 27 | 28 | // Print test in a compiler compatible format. 29 | CppUnit::CompilerOutputter outputter( &result, std::cerr ); 30 | outputter.write(); 31 | 32 | return result.wasSuccessful() ? 0 : 1; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/matrix/test_main.cpp: -------------------------------------------------------------------------------- 1 | #include "plib.h" 2 | 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int 12 | main( int argc, char* argv[] ) 13 | { 14 | // Create the event manager and test controller 15 | CppUnit::TestResult controller; 16 | 17 | // Add a listener that colllects test result 18 | CppUnit::TestResultCollector result; 19 | controller.addListener( &result ); 20 | 21 | // Add a listener that print dots as test run. 22 | CppUnit::BriefTestProgressListener progress; 23 | controller.addListener( &progress ); 24 | 25 | // Add the top suite to the test runner 26 | CppUnit::TestRunner runner; 27 | runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); 28 | runner.run( controller ); 29 | 30 | // Print test in a compiler compatible format. 31 | CppUnit::CompilerOutputter outputter( &result, std::cerr ); 32 | outputter.write(); 33 | 34 | return result.wasSuccessful() ? 0 : 1; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /numerical/fft_.cpp: -------------------------------------------------------------------------------- 1 | #include "fft.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | template void bitrv2(int , BasicArray &) ; 8 | template void bitrv(int , BasicArray &) ; 9 | template void cdft(int , float , float , BasicArray &) ; 10 | template void rdft(int , float , float , BasicArray &) ; 11 | template void ddct(int , float , float , BasicArray &) ; 12 | template void ddst(int , float , float , BasicArray &) ; 13 | template void dfct(int , float , float , BasicArray &) ; 14 | template void dfst(int , float , float , BasicArray &) ; 15 | 16 | 17 | template void bitrv2(int , BasicArray &) ; 18 | template void bitrv(int , BasicArray &) ; 19 | template void cdft(int , double , double , BasicArray &) ; 20 | template void rdft(int , double , double , BasicArray &) ; 21 | template void ddct(int , double , double , BasicArray &) ; 22 | template void ddst(int , double , double , BasicArray &) ; 23 | template void dfct(int , double , double , BasicArray &) ; 24 | template void dfst(int , double , double , BasicArray &) ; 25 | 26 | 27 | #endif 28 | 29 | } 30 | -------------------------------------------------------------------------------- /image/color.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 50,56 **** 3 | Color blackColor(0,0,0) ; 4 | */ 5 | 6 | - double 7 | Matrix::norm(void) { 8 | #ifdef USE_EXCEPTION 9 | throw MatrixErr(); 10 | --- 50,56 ---- 11 | Color blackColor(0,0,0) ; 12 | */ 13 | 14 | + template <> double 15 | Matrix::norm(void) { 16 | #ifdef USE_EXCEPTION 17 | throw MatrixErr(); 18 | *************** 19 | *** 63,69 **** 20 | } 21 | 22 | #ifndef USING_VCC 23 | - int Matrix::read(char* filename,int r, int c) { 24 | ifstream fin(filename) ; 25 | if(!fin) { 26 | resize(1,1) ; 27 | --- 63,69 ---- 28 | } 29 | 30 | #ifndef USING_VCC 31 | + template <> int Matrix::read(char* filename,int r, int c) { 32 | ifstream fin(filename) ; 33 | if(!fin) { 34 | resize(1,1) ; 35 | *************** 36 | *** 89,95 **** 37 | } 38 | #endif 39 | 40 | - int Vector::minIndex() const { 41 | #ifdef USE_EXCEPTION 42 | throw MatrixErr() ; 43 | #else 44 | --- 89,95 ---- 45 | } 46 | #endif 47 | 48 | + template <> int Vector::minIndex() const { 49 | #ifdef USE_EXCEPTION 50 | throw MatrixErr() ; 51 | #else 52 | -------------------------------------------------------------------------------- /include/plib_config.h.vc: -------------------------------------------------------------------------------- 1 | // define if you want to use exception handling 2 | #define USE_EXCEPTION 3 | //#undef USE_EXCEPTION 4 | 5 | // define if you want verbose exception handling 6 | #undef VERBOSE_EXCEPTION 7 | 8 | // define if you have the ISO C++ friend declaration style 9 | #undef HAVE_ISO_FRIEND_DECL 10 | 11 | // define if you can handle the template of template class 12 | #undef HAVE_TEMPLATE_OF_TEMPLATE 13 | 14 | // define if you can use -fno-implicit-template 15 | #undef NO_IMPLICIT_TEMPLATES 16 | 17 | // define if you want Image Magick 18 | #undef WITH_IMAGE_MAGICK 19 | 20 | // define if you want to do range validity checking 21 | // and also other debugging functions 22 | #undef DEBUG_PLIB 23 | 24 | // Define if you want the matrix to be in column order rather than row order. 25 | // Column ordering is used by fortran and OpenGL. 26 | #undef COLUMN_ORDER 27 | 28 | // the name of the package 29 | #undef PACKAGE 30 | 31 | // the version of the package 32 | #undef VERSION 33 | 34 | // if the C++ compiler supports namespaces 35 | #undef HAVE_NAMESPACE 36 | 37 | // Specify if OpenGL is present on this system 38 | #undef WITH_OPENGL 39 | 40 | #define USING_VCC 41 | #define INCLUDE_TEMPLATE_SOURCE 42 | 43 | #define DEBUG_PLIB -------------------------------------------------------------------------------- /examples/image/randomImg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | const double MaxRandom = 32767 ; 6 | 7 | double randUnity(){ 8 | return double(rand())/MaxRandom ; 9 | } 10 | 11 | int randColor(){ 12 | return int(randUnity()*255.0); 13 | } 14 | 15 | int main(){ 16 | 17 | #ifdef WITH_IMAGE_MAGICK 18 | IM_Image A ; 19 | IM_ColorImage B ; 20 | 21 | srand(356) ; 22 | 23 | A.resize(100,100) ; 24 | B.resize(A.rows(),A.cols()) ; 25 | 26 | 27 | double sinF = M_PI/double(A.cols())*0.5 ; 28 | for(int i=0;i 28 | ], 29 | [return 1;], 30 | [ has_cppunit=yes], 31 | [ has_cppunit=no]) 32 | 33 | CPPFLAGS="$SAVE_CPPFLAGS" 34 | LDFLAGS="$SAVE_LDFLAGS" 35 | LIBS="$SAVE_LIBS" 36 | AC_LANG_RESTORE 37 | fi 38 | ]) 39 | 40 | AC_MSG_RESULT($has_cppunit) 41 | if test x"$has_cppunit" = xyes; then 42 | AC_DEFINE(HAS_CPPUNIT) 43 | AC_SUBST(CPPUNIT_CPPFLAGS) 44 | AC_SUBST(CPPUNIT_LIBS) 45 | fi 46 | 47 | AM_CONDITIONAL(BUILD_CPPUNIT_TESTS,test x"$has_cppunit" = xyes) 48 | 49 | ]) 50 | 51 | -------------------------------------------------------------------------------- /matrix/matrixTool.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrixTool.cpp 3 | Purpose: 4 | Revision: $Id: matrixTool.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (26 January, 1999) 6 | Modified by: Martin Schuerch 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1999 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #include "matrixTool.h" 26 | 27 | namespace PLib { 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /matrix/matrix_char.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - Matrix& 7 | Matrix::operator*=(double a) 8 | { 9 | char *p1 ; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> Matrix& 15 | Matrix::operator*=(double a) 16 | { 17 | char *p1 ; 18 | *************** 19 | *** 40,46 **** 20 | return *this ; 21 | } 22 | 23 | - Matrix& 24 | Matrix::operator+=(double a) 25 | { 26 | char *p1 ; 27 | --- 40,46 ---- 28 | return *this ; 29 | } 30 | 31 | + template <> Matrix& 32 | Matrix::operator+=(double a) 33 | { 34 | char *p1 ; 35 | *************** 36 | *** 51,57 **** 37 | return *this ; 38 | } 39 | 40 | - Matrix& 41 | Matrix::operator-=(double a) 42 | { 43 | char *p1 ; 44 | --- 51,57 ---- 45 | return *this ; 46 | } 47 | 48 | + template <> Matrix& 49 | Matrix::operator-=(double a) 50 | { 51 | char *p1 ; 52 | *************** 53 | *** 62,68 **** 54 | return *this ; 55 | } 56 | 57 | - Matrix& 58 | Matrix::operator/=(double a) 59 | { 60 | char *p1 ; 61 | --- 62,68 ---- 62 | return *this ; 63 | } 64 | 65 | + template <> Matrix& 66 | Matrix::operator/=(double a) 67 | { 68 | char *p1 ; 69 | -------------------------------------------------------------------------------- /include/plib.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: plib.h 3 | Purpose: Defines values needed by every module of NURBS++ 4 | Revision: $Id: plib.h,v 1.2 2002/05/22 17:06:47 philosophil Exp $ 5 | Created by: Philippe Lavoie (21 May, 2002) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 2002 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #ifndef PLIB_HEADER 26 | #define PLIB_HEADER 27 | 28 | #define GCC_VERSION (__GNUC__ * 10000 \ 29 | + __GNUC_MINOR__ * 100 \ 30 | + __GNUC_PATCHLEVEL__) 31 | 32 | #include "plib_config.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /matrix/specialType.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | File: specialType.h 3 | Purpose: 4 | Revision: $Id: specialType.h,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: Martin Schuerch 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1999 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #ifndef _Matrix_specialType_h_ 26 | #define _Matrix_specialType_h_ 27 | 28 | #include "matrix_global.h" 29 | #include 30 | 31 | #include "matrixTool.h" 32 | #include "coordinate.h" 33 | #include "point_nd.h" 34 | #include "hpoint_nd.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /matrix/Makefile.am: -------------------------------------------------------------------------------- 1 | #CXXFLAGS = @CXXFLAGS@ -DMATRIX_TEMPLATE_INSTANTIATION 2 | 3 | EXTRA_DIST = barray.cpp barray2d.cpp matrix.cpp vector.cpp 4 | 5 | pkginclude_HEADERS = barray.h galloc2d.h barray2d.h hpoint_nd.h matrixTool.h coordinate.h point_nd.h cvector.h specialType.h error.h list.h specialVcc.h galloc.h matrix.h vector.h matrix_global.h 6 | 7 | INCLUDES = -I../include @CPPUNIT_CPPFLAGS@ 8 | 9 | lib_LTLIBRARIES = libmatrix.la 10 | libmatrix_la_SOURCES = error.cpp cvector.cpp list.cpp point_nd.cpp hpoint_nd.cpp coordinate.cpp matrixTool.cpp 11 | libmatrix_la_SOURCES += barray_int.cpp barray2d_int.cpp matrix_int.cpp vector_int.cpp 12 | libmatrix_la_SOURCES += barray_float.cpp barray2d_float.cpp matrix_float.cpp vector_float.cpp 13 | libmatrix_la_SOURCES += barray_double.cpp barray2d_double.cpp matrix_double.cpp vector_double.cpp 14 | libmatrix_la_SOURCES += barray_uchar.cpp barray2d_uchar.cpp matrix_uchar.cpp vector_uchar.cpp 15 | libmatrix_la_SOURCES += barray_char.cpp barray2d_char.cpp matrix_char.cpp vector_char.cpp 16 | libmatrix_la_SOURCES += barray_point.cpp barray2d_point.cpp matrix_point.cpp vector_point.cpp 17 | libmatrix_la_SOURCES += barray_hpoint.cpp barray2d_hpoint.cpp matrix_hpoint.cpp vector_hpoint.cpp 18 | libmatrix_la_SOURCES += barray_complex.cpp barray2d_complex.cpp matrix_complex.cpp vector_complex.cpp 19 | libmatrix_la_SOURCES += barray_coordinate.cpp barray2d_coordinate.cpp 20 | libmatrix_la_SOURCES += barray_void.cpp 21 | 22 | 23 | libmatrix_la_LDFLAGS = -version-info 1:0:0 24 | 25 | 26 | -------------------------------------------------------------------------------- /nurbs/f_nurbsS.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsS.cpp" 2 | 3 | #ifdef __GNUG__ 4 | 5 | namespace PLib { 6 | 7 | template class NurbsSurface ; 8 | 9 | template void gordonSurface(NurbsCurveArray& lU, NurbsCurveArray& lV, const Matrix< Point_nD >& intersections, NurbsSurface& gS); 10 | template int surfMeshParams(const Matrix< Point_nD >& Q, Vector& uk, Vector& vl); 11 | template int surfMeshParamsH(const Matrix< HPoint_nD >& Q, Vector& uk, Vector& vl); 12 | template int surfMeshParamsClosedU(const Matrix< Point_nD >& Q, Vector& uk, Vector& vl, int degU); 13 | template int surfMeshParamsClosedUH(const Matrix< HPoint_nD >& Q, Vector& uk, Vector& vl, int degU); 14 | template void globalSurfInterpXY(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S); 15 | template void globalSurfInterpXY(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S, const Vector& uk, const Vector& vk); 16 | template void globalSurfApprox(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S, double error); 17 | 18 | template void projectToLine(const Point_nD& S, const Point_nD& Trj, const Point_nD& pnt, Point_nD& p) ; 19 | template void wrapPointMatrix(const Matrix< Point_nD >& Q, int d, int dir, Matrix< Point_nD >& Qw); 20 | 21 | template class OpAreaFcn ; 22 | template class OpAreaAuxFcn ; 23 | 24 | } // end namespace 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /image/rec_filter_.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: rec_filter.cpp 3 | Purpose: 4 | Revision: $Id: rec_filter_.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (18 February 1999) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "rec_filter.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | template class RecursiveFilter; 32 | template class RecursiveFilter; 33 | template class RecursiveFilter; 34 | template class RecursiveFilter; 35 | template class RecursiveFilter; 36 | 37 | #endif 38 | 39 | } 40 | -------------------------------------------------------------------------------- /matrix/matrix_hpoint.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - double 7 | Matrix::norm(void) { 8 | int i,j ; 9 | double sumX, sumY, sumZ, sumW, maxsum; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> double 15 | Matrix::norm(void) { 16 | int i,j ; 17 | double sumX, sumY, sumZ, sumW, maxsum; 18 | *************** 19 | *** 58,64 **** 20 | } 21 | 22 | 23 | - double 24 | Matrix::norm(void) { 25 | int i,j ; 26 | double sumX, sumY, sumZ, sumW, maxsum; 27 | --- 58,64 ---- 28 | } 29 | 30 | 31 | + template <> double 32 | Matrix::norm(void) { 33 | int i,j ; 34 | double sumX, sumY, sumZ, sumW, maxsum; 35 | *************** 36 | *** 89,95 **** 37 | } 38 | 39 | 40 | - double 41 | Matrix::norm(void) { 42 | int i,j ; 43 | double sumX, sumY, sumZ, sumW, maxsum; 44 | --- 89,95 ---- 45 | } 46 | 47 | 48 | + template <> double 49 | Matrix::norm(void) { 50 | int i,j ; 51 | double sumX, sumY, sumZ, sumW, maxsum; 52 | *************** 53 | *** 119,125 **** 54 | return sqrt(maxsum); 55 | } 56 | 57 | - double 58 | Matrix::norm(void) { 59 | int i,j ; 60 | double sumX, sumY, sumZ, sumW, maxsum; 61 | --- 119,125 ---- 62 | return sqrt(maxsum); 63 | } 64 | 65 | + template <> double 66 | Matrix::norm(void) { 67 | int i,j ; 68 | double sumX, sumY, sumZ, sumW, maxsum; 69 | -------------------------------------------------------------------------------- /examples/nurbs/tdrawAa.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | 6 | #ifdef WITH_IMAGE_MAGICK 7 | 8 | cerr << "Testing the anti-aliased drawing of a nurbs curve\n" ; 9 | 10 | PlNurbsCurvef profile ; 11 | 12 | profile.makeCircle(Point3Df(0,0,0),Point3Df(1,0,0),Point3Df(0,0,1),5,0,M_PI) ; 13 | 14 | 15 | IM_ColorImage img ; 16 | 17 | img.resize(200,200) ; 18 | 19 | PlNurbsCurvef trajectory ; 20 | 21 | trajectory.makeCircle(Point3Df(100,100,0),70,M_PI*0.25,M_PI*0.75) ; 22 | 23 | trajectory.drawAaImg(img,Color(255,255,255),profile,3) ; 24 | 25 | Vector_HPoint3Df t2(4) ; 26 | 27 | t2[0] = HPoint3Df(40,50,0,1) ; 28 | //t2[1] = HPoint3Df(70,30,0) ; 29 | t2[1] = HPoint3Df(80,60,0,1) ; 30 | t2[2] = HPoint3Df(60,80,0,1) ; 31 | t2[3] = HPoint3Df(140,150,0,1) ; 32 | 33 | Vector_FLOAT U(8) ; 34 | U[0] = U[1] = U[2] = U[3] = 0.0 ; 35 | U[4] = U[5] = U[6] = U[7] = 1.0 ; 36 | 37 | PlNurbsCurvef trajectory2(t2,U,3) ; 38 | 39 | 40 | Vector_Point3Df pp(5) ; 41 | 42 | pp[0] = Point3Df(-7,0,0) ; 43 | pp[1] = Point3Df(-3,0,1) ; 44 | pp[2] = Point3Df(0,0,0) ; 45 | pp[3] = Point3Df(3,0,1) ; 46 | pp[4] = Point3Df(7,0,0) ; 47 | 48 | profile.globalInterp(pp,3) ; 49 | 50 | trajectory2.drawAaImg(img,Color(255,255,0),profile,3) ; 51 | 52 | trajectory2.makeCircle(Point3Df(80,80,0),50,0,M_PI) ; 53 | trajectory2.drawAaImg(img,Color(0,255,0)) ; 54 | 55 | img.write("tdrawAa.pnm") ; 56 | 57 | cerr << "The result is stored in tdrawAa.pnm\n" ; 58 | 59 | #else 60 | cerr << "This program require Image Magick\n" ; 61 | #endif 62 | 63 | return 0 ; 64 | } 65 | -------------------------------------------------------------------------------- /examples/nurbs/tmeasures.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | int deg = 3 ; 7 | 8 | using namespace PLib ; 9 | 10 | Vector_HPoint3Df P(11) ; 11 | 12 | P[0] = HPoint3Df(0,000,0,1) ; 13 | P[1] = HPoint3Df(0,050,0,1) ; 14 | P[2] = HPoint3Df(0,100,0,1) ; 15 | P[3] = HPoint3Df(0,150,0,1) ; 16 | P[4] = HPoint3Df(0,200,0,1) ; 17 | P[5] = HPoint3Df(0,250,0,1) ; 18 | P[6] = HPoint3Df(0,300,0,1) ; 19 | P[7] = HPoint3Df(0,350,0,1) ; 20 | P[8] = HPoint3Df(0,400,0,1) ; 21 | P[9] = HPoint3Df(0,450,0,1) ; 22 | P[10]= HPoint3Df(0,500,0,1) ; 23 | 24 | PlNurbsCurvef curve1 ; 25 | 26 | curve1.globalInterpH(P,deg) ; 27 | double length = curve1.length(1e-6,100); 28 | cout << "Length = " << length << "\n" ; 29 | 30 | double radius = 10; 31 | double area ; 32 | 33 | PlNurbsSurfacef surface ; 34 | 35 | PlNurbsCurvef curve2; 36 | curve2.makeCircle(Point3Df(0,0,0),Point3Df(1,0,0),Point3Df(0,0,1),radius,0,2*M_PI) ; 37 | surface.sweep(curve1,curve2,10) ; 38 | surface.writeDisplayQUADMESH("cylinder.obj"); 39 | surface.writeVRML("cylinder.wrl"); 40 | area = surface.area(1e-3,25); 41 | cerr << "Area cylinder = " << area 42 | << " ( " << 500*2*M_PI*10 43 | << ")" << "\n" << std::flush ; 44 | 45 | surface.makeSphere(Point3Df(0,0,0),radius) ; 46 | 47 | surface.writeDisplayQUADMESH("sphere.obj"); 48 | area = surface.area(1e-3,25); 49 | cerr << "Area sphere = " << area 50 | << " ( " << (4*M_PI*radius*radius) 51 | << ")" << "\n" ; 52 | 53 | surface.writeVRML("sphere.wrl",Color(0,0,255)); 54 | 55 | return 0 ; 56 | } 57 | -------------------------------------------------------------------------------- /examples/numerical/tint2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "integrate.h" 5 | 6 | using namespace PLib ; 7 | 8 | // But here goes, (I = Integral sign) 9 | // A = II F(S(u,v) du dv 10 | // = I G(u) du 11 | // where 12 | // G(u) = I F(s(u,v)) dv 13 | // so compute A by calling 14 | // integrate(G,...) ; 15 | 16 | struct F : public ClassPOvoid { 17 | double operator()(double u, void* v) { 18 | nf++; 19 | return exp(*((double*)v)) * sin(u); 20 | } 21 | int nf ; 22 | F(): nf(0) {;} 23 | }; 24 | 25 | struct G : public ClassPO { 26 | double operator()(double v) { 27 | F f ; 28 | double err, integral; 29 | integral = integrate2((ClassPOvoid*)&f,(double*) &v, 0.0,M_PI/2, 1.0e-15, 3200, err); 30 | ng += f.nf; 31 | return integral; 32 | } 33 | int ng ; 34 | G(): ng(0) {;} 35 | }; 36 | 37 | 38 | main(){ 39 | double i, err; 40 | G g ; 41 | F f ; 42 | 43 | // the casting is necessary with g++ and -fno_implicit_templates 44 | i = integrate((ClassPO*)&g, 0.0, 1.0, 1.0e-15,3200, err); 45 | printf("II= integral_[0,1] integral_[0,Pi/2] e^y sin(x)dy dx\n"); 46 | printf("II= %lg\t err= %lg\t N= %d\n", i, err, g.ng); 47 | printf("The true value is II = (e-1) = %lg\n",(exp(1)-1)); 48 | 49 | double a = 1; 50 | i = integrate2((ClassPOvoid*)&f,(double*) &a,0.0, M_PI/2, 1.0e-15, 3200, err); 51 | printf("I= integral_[0,Pi/2] e sin(x) dx\n"); 52 | printf("I= %lg\t err= %lg\t N= %d\n", i, err, f.nf); 53 | printf("The true value is I = e = %lg \n",(exp(1))); 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /matrix/matrix_uchar.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - Matrix& 7 | Matrix::operator*=(double a) 8 | { 9 | unsigned char *p1 ; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> Matrix& 15 | Matrix::operator*=(double a) 16 | { 17 | unsigned char *p1 ; 18 | *************** 19 | *** 40,46 **** 20 | return *this ; 21 | } 22 | 23 | - Matrix& 24 | Matrix::operator+=(double a) 25 | { 26 | unsigned char *p1 ; 27 | --- 40,46 ---- 28 | return *this ; 29 | } 30 | 31 | + template <> Matrix& 32 | Matrix::operator+=(double a) 33 | { 34 | unsigned char *p1 ; 35 | *************** 36 | *** 52,58 **** 37 | } 38 | 39 | 40 | - Matrix& 41 | Matrix::operator-=(double a) 42 | { 43 | unsigned char *p1 ; 44 | --- 52,58 ---- 45 | } 46 | 47 | 48 | + template <> Matrix& 49 | Matrix::operator-=(double a) 50 | { 51 | unsigned char *p1 ; 52 | *************** 53 | *** 64,70 **** 54 | } 55 | 56 | 57 | - Matrix& 58 | Matrix::operator/=(double a) 59 | { 60 | unsigned char *p1 ; 61 | --- 64,70 ---- 62 | } 63 | 64 | 65 | + template <> Matrix& 66 | Matrix::operator/=(double a) 67 | { 68 | unsigned char *p1 ; 69 | -------------------------------------------------------------------------------- /matrix/matrix_point.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 27,33 **** 3 | 4 | namespace PLib { 5 | 6 | - double 7 | Matrix::norm(void) { 8 | int i,j ; 9 | double sumX, sumY, sumZ, maxsum; 10 | --- 27,33 ---- 11 | 12 | namespace PLib { 13 | 14 | + template <> double 15 | Matrix::norm(void) { 16 | int i,j ; 17 | double sumX, sumY, sumZ, maxsum; 18 | *************** 19 | *** 55,61 **** 20 | return sqrt(maxsum); 21 | } 22 | 23 | - double 24 | Matrix::norm(void) { 25 | int i,j ; 26 | double sumX, sumY, sumZ, maxsum; 27 | --- 55,61 ---- 28 | return sqrt(maxsum); 29 | } 30 | 31 | + template <> double 32 | Matrix::norm(void) { 33 | int i,j ; 34 | double sumX, sumY, sumZ, maxsum; 35 | *************** 36 | *** 83,89 **** 37 | return sqrt(maxsum); 38 | } 39 | 40 | - double 41 | Matrix::norm(void) { 42 | int i,j ; 43 | double sumX, sumY, sumZ, maxsum; 44 | --- 83,89 ---- 45 | return sqrt(maxsum); 46 | } 47 | 48 | + template <> double 49 | Matrix::norm(void) { 50 | int i,j ; 51 | double sumX, sumY, sumZ, maxsum; 52 | *************** 53 | *** 111,117 **** 54 | return sqrt(maxsum); 55 | } 56 | 57 | - double 58 | Matrix::norm(void) { 59 | int i,j ; 60 | double sumX, sumY, sumZ, maxsum; 61 | --- 111,117 ---- 62 | return sqrt(maxsum); 63 | } 64 | 65 | + template <> double 66 | Matrix::norm(void) { 67 | int i,j ; 68 | double sumX, sumY, sumZ, maxsum; 69 | -------------------------------------------------------------------------------- /nurbs/f_surface.cpp: -------------------------------------------------------------------------------- 1 | #include "surface.cpp" 2 | 3 | namespace PLib { 4 | 5 | template <> 6 | int ParaSurface::intersectWith(const ParaSurface &S, Point_nD& p, float& u, float& v, float& s, float& t, int maxI, float um, float uM, float vm, float vM) const { 7 | cerr << "NOT DEFINED FOR 2D SURFACES.\n"; 8 | return 0; 9 | } 10 | 11 | template <> 12 | int ParaSurface::intersectWith(const ParaSurface &S, struct InterPoint &iter, int maxI, float um, float uM, float vm, float vM) const { 13 | cerr << "NOT DEFINED FOR 2D SURFACES.\n"; 14 | return 0; 15 | } 16 | 17 | template <> 18 | int ParaSurface::writeVRML97(ostream &fout,const Color& color,int Nu,int Nv, float uS, float uE, float vS, float vE) const{ 19 | cerr << "NOT DEFINED FOR 2D SURFACES.\n" ; 20 | return 0; 21 | } 22 | 23 | #ifdef NO_IMPLICIT_TEMPLATES 24 | 25 | template class InterPoint ; 26 | template class InterPoint ; 27 | 28 | template class ParaSurface ; 29 | template class ParaSurface ; 30 | 31 | template void intersectSurfaces(const ParaSurface&, const ParaSurface&, BasicList >&, int, float, float, float, float) ; 32 | 33 | template void intersectSurfaces(const ParaSurface&, const ParaSurface&, BasicList >&, int, float, float, float, float) ; 34 | 35 | #endif 36 | 37 | } 38 | 39 | #ifdef NO_IMPLICIT_TEMPLATES 40 | template class BasicList > ; 41 | template class BasicList > ; 42 | #endif 43 | -------------------------------------------------------------------------------- /nurbs/d_nurbsS.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsS.cpp" 2 | 3 | namespace PLib { 4 | 5 | #ifdef NO_IMPLICIT_TEMPLATES 6 | 7 | // double instantiation 8 | 9 | template class NurbsSurface ; 10 | 11 | template void gordonSurface(NurbsCurveArray& lU, NurbsCurveArray& lV, const Matrix< Point_nD >& intersections, NurbsSurface& gS); 12 | template int surfMeshParams(const Matrix< Point_nD >& Q, Vector& uk, Vector& vl); 13 | template int surfMeshParamsH(const Matrix< HPoint_nD >& Q, Vector& uk, Vector& vl); 14 | template int surfMeshParamsClosedU(const Matrix< Point_nD >& Q, Vector& uk, Vector& vl, int degU); 15 | template int surfMeshParamsClosedUH(const Matrix< HPoint_nD >& Q, Vector& uk, Vector& vl, int degU); 16 | template void globalSurfInterpXY(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S); 17 | template void globalSurfInterpXY(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S, const Vector& uk, const Vector& vk); 18 | template void globalSurfApprox(const Matrix< Point_nD >& Q, int pU, int pV, NurbsSurface& S, double error); 19 | 20 | template void projectToLine(const Point_nD& S, const Point_nD& Trj, const Point_nD& pnt, Point_nD& p) ; 21 | template void wrapPointMatrix(const Matrix< Point_nD >& Q, int d, int dir, Matrix< Point_nD >& Qw); 22 | 23 | template class OpAreaFcn ; 24 | template class OpAreaAuxFcn ; 25 | 26 | 27 | #endif 28 | 29 | } 30 | -------------------------------------------------------------------------------- /matrix/coordinate.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: coordinate.cpp 3 | Purpose: 4 | Revision: $Id: coordinate.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (26 January, 1999) 6 | Modified by: Martin Schuerch 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1999 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "coordinate.h" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template Coordinate maximum(Coordinate, Coordinate) ; 33 | template Coordinate maximumRef(const Coordinate&, const Coordinate&) ; 34 | template Coordinate minimum(Coordinate, Coordinate) ; 35 | template Coordinate minimumRef(const Coordinate&, const Coordinate&) ; 36 | 37 | #endif 38 | } // end namespace 39 | -------------------------------------------------------------------------------- /nurbs/d_surface.cpp: -------------------------------------------------------------------------------- 1 | #include "surface.cpp" 2 | 3 | namespace PLib { 4 | 5 | template <> 6 | int ParaSurface::intersectWith(const ParaSurface &S, Point_nD& p, double& u, double& v, double& s, double& t, int maxI, double um, double uM, double vm, double vM) const { 7 | cerr << "NOT DEFINED FOR 2D SURFACES.\n"; 8 | return 0; 9 | } 10 | 11 | template <> 12 | int ParaSurface::intersectWith(const ParaSurface &S, struct InterPoint &iter, int maxI, double um, double uM, double vm, double vM) const { 13 | cerr << "NOT DEFINED FOR 2D SURFACES.\n"; 14 | return 0; 15 | } 16 | 17 | template <> 18 | int ParaSurface::writeVRML97(ostream &fout,const Color& color,int Nu,int Nv, double uS, double uE, double vS, double vE) const{ 19 | cerr << "NOT DEFINED FOR 2D SURFACES.\n" ; 20 | return 0; 21 | } 22 | 23 | #ifdef NO_IMPLICIT_TEMPLATES 24 | 25 | template class InterPoint ; 26 | template class InterPoint ; 27 | 28 | template class ParaSurface ; 29 | template class ParaSurface ; 30 | 31 | template void intersectSurfaces(const ParaSurface&, const ParaSurface&, BasicList >&, int, double, double, double, double) ; 32 | template void intersectSurfaces(const ParaSurface&, const ParaSurface&, BasicList >&, int, double, double, double, double) ; 33 | 34 | #endif 35 | 36 | } 37 | 38 | #ifdef NO_IMPLICIT_TEMPLATES 39 | template class BasicList > ; 40 | template class BasicList > ; 41 | #endif 42 | -------------------------------------------------------------------------------- /matrix/matrix_int.cpp.rej: -------------------------------------------------------------------------------- 1 | *************** 2 | *** 29,39 **** 3 | 4 | namespace PLib { 5 | 6 | - void Matrix::qSort(){ 7 | qsort((char*)m,rows()*cols(),sizeof(int),compareInt) ; 8 | } 9 | 10 | - Matrix& 11 | Matrix::operator*=(double a) 12 | { 13 | int *p1 ; 14 | --- 29,39 ---- 15 | 16 | namespace PLib { 17 | 18 | + template <> void Matrix::qSort(){ 19 | qsort((char*)m,rows()*cols(),sizeof(int),compareInt) ; 20 | } 21 | 22 | + template <> Matrix& 23 | Matrix::operator*=(double a) 24 | { 25 | int *p1 ; 26 | *************** 27 | *** 46,52 **** 28 | return *this ; 29 | } 30 | 31 | - Matrix& 32 | Matrix::operator+=(double a) 33 | { 34 | int *p1 ; 35 | --- 46,52 ---- 36 | return *this ; 37 | } 38 | 39 | + template <> Matrix& 40 | Matrix::operator+=(double a) 41 | { 42 | int *p1 ; 43 | *************** 44 | *** 57,63 **** 45 | return *this ; 46 | } 47 | 48 | - Matrix& 49 | Matrix::operator-=(double a) 50 | { 51 | int *p1 ; 52 | --- 57,63 ---- 53 | return *this ; 54 | } 55 | 56 | + template <> Matrix& 57 | Matrix::operator-=(double a) 58 | { 59 | int *p1 ; 60 | *************** 61 | *** 68,74 **** 62 | return *this ; 63 | } 64 | 65 | - Matrix& 66 | Matrix::operator/=(double a) 67 | { 68 | int *p1 ; 69 | --- 68,74 ---- 70 | return *this ; 71 | } 72 | 73 | + template <> Matrix& 74 | Matrix::operator/=(double a) 75 | { 76 | int *p1 ; 77 | -------------------------------------------------------------------------------- /image/filter.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: rec_filter.h 3 | Purpose: 4 | Revision: $Id: filter.h,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (18 February 1999) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | 27 | #ifndef _Matrix_Filters_h_ 28 | #define _Matrix_Filters_h_ 29 | #include "barray2d.h" 30 | 31 | /*! 32 | */ 33 | namespace PLib { 34 | /*! 35 | */ 36 | namespace Filter { 37 | //void mean(const Basic2DArray& a, Basic2DArray& b); 38 | template 39 | void median(const Basic2DArray& a, Basic2DArray& b); 40 | template 41 | void medianT(const Basic2DArray& a, Basic2DArray& b, T value, int op); 42 | } 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /matrix/barray2d_int.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_int.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | 39 | #endif 40 | 41 | } 42 | -------------------------------------------------------------------------------- /matrix/barray2d_char.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_char.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | #endif 39 | 40 | } 41 | -------------------------------------------------------------------------------- /matrix/barray2d_float.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | #endif 39 | 40 | } 41 | -------------------------------------------------------------------------------- /matrix/barray2d_double.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | #endif 39 | 40 | } 41 | -------------------------------------------------------------------------------- /matrix/point_nd.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: point_nd.cpp 3 | Purpose: 4 | Revision: $Id: point_nd.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (26 January, 1999) 6 | Modified by: Martin Schuerch 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1999 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #ifndef POINT_SOURCES 27 | #define POINT_SOURCES 28 | 29 | 30 | #include "point_nd.h" 31 | 32 | namespace PLib { 33 | 34 | float Point_nD::dumbVar ; 35 | double Point_nD::dumbVar ; 36 | 37 | /* 38 | #ifdef NO_IMPLICIT_TEMPLATES 39 | 40 | template class Point_nD ; 41 | template class Point_nD ; 42 | template class Point_nD ; 43 | template class Point_nD ; 44 | 45 | #endif 46 | */ 47 | 48 | } // end library 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /matrix/barray2d_complex.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_complex.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | 39 | #endif 40 | 41 | } 42 | -------------------------------------------------------------------------------- /matrix/hpoint_nd.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: hpoint_nd.cpp 3 | Purpose: 4 | Revision: $Id: hpoint_nd.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (26 January, 1999) 6 | Modified by: Martin Schuerch 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1999 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #ifndef HPOINT_SOURCES 27 | #define HPOINT_SOURCES 28 | 29 | #include "hpoint_nd.h" 30 | 31 | namespace PLib { 32 | 33 | 34 | float HPoint_nD::dumbVar ; 35 | double HPoint_nD::dumbVar ; 36 | 37 | /* 38 | #ifdef NO_IMPLICIT_TEMPLATES 39 | 40 | template class HPoint_nD ; 41 | template class HPoint_nD ; 42 | template class HPoint_nD ; 43 | template class HPoint_nD ; 44 | 45 | #endif 46 | */ 47 | 48 | } // end library 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /acconfig.h: -------------------------------------------------------------------------------- 1 | // define if you want to use exception handling 2 | #undef USE_EXCEPTION 3 | 4 | // define if you want verbose exception handling 5 | #undef VERBOSE_EXCEPTION 6 | 7 | // define if you have the ISO C++ friend declaration style 8 | #undef HAVE_ISO_FRIEND_DECL 9 | 10 | // define if you can handle the template of template class 11 | #undef HAVE_TEMPLATE_OF_TEMPLATE 12 | 13 | // define if you can use -fno-implicit-template 14 | #undef NO_IMPLICIT_TEMPLATES 15 | 16 | // define if you can use -frepo 17 | #undef INCLUDE_TEMPLATE_SOURCE 18 | 19 | // define if you want Image Magick 20 | #undef WITH_IMAGE_MAGICK 21 | 22 | // define if you want to do range validity checking 23 | // and also other debugging functions 24 | #undef DEBUG_PLIB 25 | 26 | // Define if you want the matrix to be in column order rather than row order. 27 | // Column ordering is used by fortran and OpenGL. 28 | #undef COLUMN_ORDER 29 | 30 | // the name of the package 31 | #undef PACKAGE 32 | 33 | // the version of the package 34 | #undef VERSION 35 | 36 | // if the C++ compiler supports namespaces 37 | #undef HAVE_NAMESPACE 38 | 39 | // Specify if OpenGL is present on this system 40 | #undef WITH_OPENGL 41 | 42 | // Specify if you are using Solaris with egcs 43 | #undef USING_GNU_SOLARIS 44 | 45 | // Specify if you are using DEC Alpha with egcs 46 | #undef USING_GNU_DECALPHA 47 | 48 | // Specify if you are using SGI with egcs 49 | #undef USING_GNU_SGI 50 | 51 | // Specify if you are using Linux (assumed with egcs) 52 | #undef USING_LINUX 53 | 54 | // Specify if you have CppUnit installed 55 | #undef HAS_CPPUNIT 56 | 57 | // Specify if you have abs defined for the Complex type 58 | #undef HAS_COMPLEX_ABS 59 | 60 | // Specify if you have conf defined for the Complex type 61 | #undef HAS_COMPLEX_CONJ 62 | -------------------------------------------------------------------------------- /matrix/barray_int.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray_int.cpp 3 | Purpose: 4 | Revision: $Id: barray_int.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | template class BasicArray ; 32 | template void resizeBasicArray(BasicArray&,int) ; 33 | template int operator!=(const BasicArray&,const BasicArray&); 34 | template int operator==(const BasicArray&,const BasicArray&); 35 | template istream& operator>>(istream& is, BasicArray& ary); 36 | template ostream& operator<<(ostream& os, const BasicArray& ary); 37 | 38 | 39 | #endif 40 | 41 | } 42 | -------------------------------------------------------------------------------- /matrix/barray2d_coordinate.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_coordinate.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | #endif 39 | 40 | } 41 | -------------------------------------------------------------------------------- /matrix/barray_char.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray.cpp 3 | Purpose: 4 | Revision: $Id: barray_char.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class BasicArray ; 33 | template void resizeBasicArray(BasicArray&,int) ; 34 | template int operator!=(const BasicArray&,const BasicArray&); 35 | template int operator==(const BasicArray&,const BasicArray&); 36 | template istream& operator>>(istream& is, BasicArray& ary); 37 | template ostream& operator<<(ostream& os, const BasicArray& ary); 38 | 39 | 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /matrix/barray_float.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray_float.cpp 3 | Purpose: 4 | Revision: $Id: barray_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class BasicArray ; 33 | template void resizeBasicArray(BasicArray&,int) ; 34 | template int operator!=(const BasicArray&,const BasicArray&); 35 | template int operator==(const BasicArray&,const BasicArray&); 36 | template istream& operator>>(istream& is, BasicArray& ary); 37 | template ostream& operator<<(ostream& os, const BasicArray& ary); 38 | 39 | 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /matrix/barray_double.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray.cpp 3 | Purpose: 4 | Revision: $Id: barray_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class BasicArray ; 33 | template void resizeBasicArray(BasicArray&,int) ; 34 | template int operator!=(const BasicArray&,const BasicArray&); 35 | template int operator==(const BasicArray&,const BasicArray&); 36 | template istream& operator>>(istream& is, BasicArray& ary); 37 | template ostream& operator<<(ostream& os, const BasicArray& ary); 38 | 39 | 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /matrix/cvector.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: cvector.cpp 3 | Purpose: 4 | Revision: $Id: cvector.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "matrix_global.h" 27 | #include "cvector.h" 28 | 29 | namespace PLib { 30 | 31 | #ifdef NO_IMPLICIT_TEMPLATES 32 | 33 | // Template instantation for g++ 34 | 35 | 36 | // Integer instantation 37 | 38 | template class CVector ; 39 | 40 | // Byte instantation 41 | 42 | template class CVector ; 43 | 44 | // Double instantation 45 | 46 | template class CVector ; 47 | 48 | // Complex instantation 49 | 50 | template class CVector ; 51 | 52 | 53 | // Ubyte instantation 54 | 55 | template class CVector ; 56 | 57 | 58 | #endif 59 | 60 | } 61 | -------------------------------------------------------------------------------- /numerical/matrixMat_.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrixMat.cpp 3 | Purpose: 4 | Revision: $Id: matrixMat_.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (22 Oct, 1997) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #include "matrixMat.cpp" 26 | 27 | namespace PLib { 28 | 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | template class LUMatrix ; 32 | template class LUMatrix ; 33 | 34 | template class SVDMatrix ; 35 | template class SVDMatrix ; 36 | 37 | template int solve(const Matrix&A, const Matrix&B, Matrix&X); 38 | template int solve(const Matrix&A, const Matrix&B, Matrix&X); 39 | 40 | template Matrix inverse(const Matrix&) ; 41 | template Matrix inverse(const Matrix&) ; 42 | 43 | #endif 44 | 45 | } 46 | -------------------------------------------------------------------------------- /matrix/barray_coordinate.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray.cpp 3 | Purpose: 4 | Revision: $Id: barray_coordinate.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class BasicArray ; 33 | template void resizeBasicArray(BasicArray&,int) ; 34 | template int operator!=(const BasicArray&,const BasicArray&); 35 | template int operator==(const BasicArray&,const BasicArray&); 36 | template istream& operator>>(istream& is, BasicArray& ary); 37 | template ostream& operator<<(ostream& os, const BasicArray& ary); 38 | 39 | 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /matrix/barray_uchar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray.cpp 3 | Purpose: 4 | Revision: $Id: barray_uchar.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class BasicArray ; 33 | template void resizeBasicArray(BasicArray&,int) ; 34 | template int operator!=(const BasicArray&,const BasicArray&); 35 | template int operator==(const BasicArray&,const BasicArray&); 36 | template istream& operator>>(istream& is, BasicArray& ary); 37 | template ostream& operator<<(ostream& os, const BasicArray& ary); 38 | 39 | 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /examples/nurbs/tnurbsS_sp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | 6 | cerr << "Testing the surface point interface for a NURBS surface.\n\n" ; 7 | 8 | PlNurbsSurfaceSPf s ; 9 | 10 | s.makeSphere(Point3Df(0,0,0),1) ; 11 | 12 | s.print(cout); 13 | 14 | s.updateMaxUV() ; 15 | 16 | cout << "This shows that there is a point on the surface associated" << endl 17 | << "with a control point. We can manipulate the point on the surface" << endl 18 | << "directly instead of manipulating the control point." << endl 19 | << "This might provide a more intuitive method to manipulate a NURBS surface." << endl 20 | << endl << endl ; 21 | 22 | cout << "The point associated with the control point 3 is\n" ; 23 | cout << "\tSurfP(3,3) = " << s.surfP(3,3) << 24 | "\n\tctrlPnts(3,3) = " << s.ctrlPnts()(3,3) << endl << endl; ; 25 | 26 | cout << "By offsetting this point by (1,2,3,0), it is now at\n" ; 27 | s.modSurfCPby(3,3,HPoint3Df(1,2,3,0)) ; 28 | cout << "\tSurfP(3,3) = " << s.surfP(3,3) << 29 | "\n\tctrlPnts()(3,3) = " << s.ctrlPnts()(3,3) << endl << endl; 30 | 31 | 32 | cout << "We can also set it to a certain value. (5,6,7,1) for example.\n" ; 33 | s.modSurfCP(3,3,HPoint3Df(5,6,7,1)) ; 34 | cout << "\tSurfP(3,3) = " << s.surfP(3,3) << 35 | "\n\tctrlPnts(3,3) = " << s.ctrlPnts()(3,3) << endl << endl; ; 36 | 37 | 38 | cout << "We want to generate a parallel surface to this one.\n" ; 39 | 40 | PlNurbsSurfaceSPf p = s.generateParallel(1.0) ; 41 | 42 | cout << "Checking if the surface are indeed 1.0 apart: " ; 43 | Point3Df d = p.pointAt(0.5,0.5) - s.pointAt(0.5,0.5) ; 44 | cout << norm(d) << endl ; 45 | 46 | 47 | cout << "The result can be seen in tnurbsS_spA.ns and tnurbsS_spB.ns.\n" ; 48 | 49 | s.write("tnurbsS_spA.ns") ; 50 | p.write("tnurbsS_spB.ns") ; 51 | 52 | return 0 ; 53 | } 54 | -------------------------------------------------------------------------------- /examples/nurbs/tnurbs_sp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | 6 | cerr << "Testing the surface point interface for a NURBS curve.\n\n" ; 7 | 8 | PlNurbsCurveSPf c ; 9 | 10 | c.makeCircle(Point3Df(100,100,0),30,0,2.0*M_PI) ; 11 | c.updateMaxU() ; 12 | 13 | cout << "This shows that there is a point on the curve associated" << endl 14 | << "with a control point. We can manipulate the point on the surface" << endl 15 | << "directly instead of manipulating the control point." << endl 16 | << "This might provide a more intuitive method to manipulate a NURBS curve." << endl 17 | << endl << endl ; 18 | 19 | cout << "The point associated with the control point 3 is\n" ; 20 | cout << "\tSurfP[3] = " << c.surfP(3) << ", ctrlPnts()[3] = " << c.ctrlPnts()[3] << endl ; 21 | 22 | cout << "By offsetting this point by (10,10,0,0), it is now at\n" ; 23 | c.modSurfCPby(3,HPoint3Df(10,10,0,0)) ; 24 | cout << "\tSurfP[3] = " << c.surfP(3) << ", ctrlPnts()[3] = " << c.ctrlPnts()[3] << endl; 25 | 26 | cout << "We can also set it to a certain value. (100,150,0,1) for example.\n" ; 27 | c.modSurfCP(3,HPoint3Df(100,150,0,1)) ; 28 | cout << "\tSurfP[3] = " << c.surfP(3) << ", ctrlPnts()[3] = " << c.ctrlPnts()[3] << endl ; 29 | 30 | 31 | cout << "\n\nNow testing to see if the maximal point of influence is computed correctly.\n" ; 32 | cout << "Look in the NURBS book for the figure2.10. \nThe values should correspond to the ones seen in that graphic.\n" ; 33 | 34 | 35 | Vector_HPoint3Df P(10) ; 36 | Vector_FLOAT U(14) ; 37 | 38 | U[0] = U[1] = U[2] = U[3] = 0.0 ; 39 | U[4] = 2.0 ; 40 | U[5] = U[6] = 4.0 ; 41 | U[7] = U[8] = U[9] = 6.0 ; 42 | U[10] = U[11] = U[12] = U[13] = 8.0 ; 43 | 44 | c.reset(P,U,3) ; 45 | 46 | for(int i=0;i ; 33 | 34 | template Vector operator+(const Vector&, const Vector&); 35 | template Vector operator-(const Vector&, const Vector&); 36 | template char operator*(const Vector&,const Vector&); 37 | template Vector operator*(const Vector& v, const double d); 38 | template Vector operator*(const Vector& v, const Complex d); 39 | template int operator==(const Vector&,const Vector&); 40 | template int operator!=(const Vector&,const Vector&); 41 | 42 | #endif 43 | 44 | } 45 | -------------------------------------------------------------------------------- /examples/nurbs/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = tleastS.png 2 | 3 | XINCLUDE = @X_CFLAGS@ 4 | XLIBS = @X_PRE_LIBS@ @X_LIBS@ -lXt -lX11 5 | MAGICK_INCLUDE = $(XINCLUDE) @magick_include@ 6 | MAGICK_LIB = @magick_lib@ 7 | MAGICK_LIBS = @magick_libs@ 8 | 9 | COMPLEXLIB = @complex_lib@ 10 | 11 | MATRIX_INCLUDE = @matrix_include@ 12 | MATRIX_LIB_FLAG = @matrix_lib_flag@ 13 | MATRIXLIB = @matrix_lib_flag@ @matrix_lib@ @complex_lib@ 14 | 15 | OPENGL_LIBS = -lglut $(GL_LFLAGS) $(GL_LIBS) $(X_EXTRA_LIBS) 16 | 17 | #INCLUDES = $(MAGICK_INCLUDE) $(GL_CFLAGS) @matrix_include@ @nurbs_include@ 18 | INCLUDES = @matrix_include@ @nurbs_include@ @option_include@ 19 | #EXTRALIBS = -lm -lc 20 | #ALLLIBS = @nurbs_libf@ $(MATRIXLIB) @option_libs@ $(EXTRALIBS) 21 | ALLLIBS = -lglut @nurbs_libf@ $(MATRIXLIB) @option_libs@ 22 | 23 | TESTS = tnurbs tnlength tnurbsS thnurbsS tnsSweep tmatrixRT tdrawAa tnInterp tnApprox tnMovePoint tnsMovePoint topengl tleastS tnurbs_sp tnurbsS_sp tclose tnurbsSub tmeasures trispline 24 | noinst_PROGRAMS = tnurbs tnlength tnurbsS thnurbsS tnsSweep tmatrixRT tdrawAa tnInterp tnApprox tnMovePoint tnsMovePoint topengl tleastS tnurbs_sp tnurbsS_sp tclose tnurbsSub tmeasures trispline 25 | 26 | LDADD = $(ALLLIBS) 27 | #LDFLAGS = $(LIBSINC) 28 | 29 | tnurbs_SOURCES = tnurbs.cpp 30 | tnlength_SOURCES = tnlength.cpp 31 | tnurbsS_SOURCES = tnurbsS.cpp 32 | thnurbsS_SOURCES = thnurbsS.cpp 33 | tnsSweep_SOURCES = tnsSweep.cpp 34 | tmatrixRT_SOURCES = tmatrixRT.cpp 35 | tdrawAa_SOURCES = tdrawAa.cpp 36 | tnInterp_SOURCES = tnInterp.cpp 37 | tnApprox_SOURCES = tnApprox.cpp 38 | tnMovePoint_SOURCES = tnMovePoint.cpp 39 | tnsMovePoint_SOURCES = tnsMovePoint.cpp 40 | topengl_SOURCES = topengl.cpp 41 | tleastS_SOURCES = tleastS.cpp 42 | tnurbs_sp_SOURCES = tnurbs_sp.cpp 43 | tnurbsS_sp_SOURCES = tnurbsS_sp.cpp 44 | tclose_SOURCES = tclose.cpp 45 | tnurbsSub_SOURCES = tnurbsSub.cpp 46 | tmeasures_SOURCES = tmeasures.cpp 47 | trispline_SOURCES = trispline.cpp 48 | 49 | 50 | -------------------------------------------------------------------------------- /matrix/vector_int.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_int.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(int),compareInt) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Vector ; 37 | 38 | template Vector operator+(const Vector&, const Vector&); 39 | template Vector operator-(const Vector&, const Vector&); 40 | template int operator*(const Vector&,const Vector&); 41 | template Vector operator*(const Vector& v, const double d); 42 | template Vector operator*(const Vector& v, const Complex d); 43 | template int operator==(const Vector&,const Vector&); 44 | template int operator!=(const Vector&,const Vector&); 45 | 46 | #endif 47 | 48 | } 49 | -------------------------------------------------------------------------------- /matrix/vector_int.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_int.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(int),compareInt) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Vector ; 37 | 38 | template Vector operator+(const Vector&, const Vector&); 39 | template Vector operator-(const Vector&, const Vector&); 40 | template int operator*(const Vector&,const Vector&); 41 | template Vector operator*(const Vector& v, const double d); 42 | template Vector operator*(const Vector& v, const Complex d); 43 | template int operator==(const Vector&,const Vector&); 44 | template int operator!=(const Vector&,const Vector&); 45 | 46 | #endif 47 | 48 | } 49 | -------------------------------------------------------------------------------- /nurbs++-config.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | exec_prefix_set=no 6 | includedir=@includedir@ 7 | 8 | usage() 9 | { 10 | cat <&2 31 | fi 32 | 33 | while test $# -gt 0; do 34 | case "$1" in 35 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 36 | *) optarg= ;; 37 | esac 38 | 39 | case $1 in 40 | --prefix=*) 41 | prefix=$optarg 42 | if test $exec_prefix_set = no ; then 43 | exec_prefix=$optarg 44 | fi 45 | ;; 46 | --prefix) 47 | echo_prefix=yes 48 | ;; 49 | --exec-prefix=*) 50 | exec_prefix=$optarg 51 | exec_prefix_set=yes 52 | ;; 53 | --exec-prefix) 54 | echo_exec_prefix=yes 55 | ;; 56 | --version) 57 | echo @NURBS_VERSION@ 58 | ;; 59 | --help) 60 | usage 0 61 | ;; 62 | --cflags) 63 | echo_cflags=yes 64 | ;; 65 | --libs) 66 | echo_libs=yes 67 | ;; 68 | *) 69 | usage 1 1>&2 70 | ;; 71 | esac 72 | shift 73 | done 74 | 75 | if test "$echo_prefix" = "yes"; then 76 | echo $prefix 77 | fi 78 | 79 | if test "$echo_exec_prefix" = "yes"; then 80 | echo $exec_prefix 81 | fi 82 | 83 | if test "$echo_cflags" = "yes"; then 84 | if test "$includedir" != "/usr/include" ; then 85 | echo -I$includedir 86 | fi 87 | fi 88 | 89 | if test "$echo_libs" = "yes"; then 90 | if test @libdir@ != /usr/lib ; then 91 | my_linker_flags="-L@libdir@" 92 | fi 93 | echo ${my_linker_flags} -lcppunit 94 | fi 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /matrix/vector_uchar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_uchar.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Vector ; 33 | 34 | template Vector operator+(const Vector&, const Vector&); 35 | template Vector operator-(const Vector&, const Vector&); 36 | template unsigned char operator*(const Vector&,const Vector&); 37 | template Vector operator*(const Vector& v, const double d); 38 | template Vector operator*(const Vector& v, const Complex d); 39 | template int operator==(const Vector&,const Vector&); 40 | template int operator!=(const Vector&,const Vector&); 41 | 42 | #endif 43 | 44 | } 45 | -------------------------------------------------------------------------------- /nurbs++-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=/NOBACKUP/smakadir/nurbs++/local 4 | exec_prefix=${prefix} 5 | exec_prefix_set=no 6 | includedir=${prefix}/include 7 | 8 | usage() 9 | { 10 | cat <&2 31 | fi 32 | 33 | while test $# -gt 0; do 34 | case "$1" in 35 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 36 | *) optarg= ;; 37 | esac 38 | 39 | case $1 in 40 | --prefix=*) 41 | prefix=$optarg 42 | if test $exec_prefix_set = no ; then 43 | exec_prefix=$optarg 44 | fi 45 | ;; 46 | --prefix) 47 | echo_prefix=yes 48 | ;; 49 | --exec-prefix=*) 50 | exec_prefix=$optarg 51 | exec_prefix_set=yes 52 | ;; 53 | --exec-prefix) 54 | echo_exec_prefix=yes 55 | ;; 56 | --version) 57 | echo @NURBS_VERSION@ 58 | ;; 59 | --help) 60 | usage 0 61 | ;; 62 | --cflags) 63 | echo_cflags=yes 64 | ;; 65 | --libs) 66 | echo_libs=yes 67 | ;; 68 | *) 69 | usage 1 1>&2 70 | ;; 71 | esac 72 | shift 73 | done 74 | 75 | if test "$echo_prefix" = "yes"; then 76 | echo $prefix 77 | fi 78 | 79 | if test "$echo_exec_prefix" = "yes"; then 80 | echo $exec_prefix 81 | fi 82 | 83 | if test "$echo_cflags" = "yes"; then 84 | if test "$includedir" != "/usr/include" ; then 85 | echo -I$includedir 86 | fi 87 | fi 88 | 89 | if test "$echo_libs" = "yes"; then 90 | if test ${exec_prefix}/lib != /usr/lib ; then 91 | my_linker_flags="-L${exec_prefix}/lib" 92 | fi 93 | echo ${my_linker_flags} -lcppunit 94 | fi 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /examples/nurbs/tnsSweep.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | Vector_Point3Df tp,cp ; 6 | PlNurbsCurvef T,C ; 7 | // setup the trajectory curve 8 | tp.resize(6) ; 9 | tp[0] = Point3Df(0,0,0) ; 10 | tp[1] = Point3Df(0,30,10) ; 11 | tp[2] = Point3Df(20,60,20) ; 12 | tp[3] = Point3Df(40,70,20) ; 13 | tp[4] = Point3Df(60,80,20) ; 14 | tp[5] = Point3Df(70,60,25) ; 15 | 16 | T.globalInterp(tp,3) ; 17 | 18 | // setup the curve to sweep 19 | 20 | cp.resize(4) ; 21 | cp[0] = Point3Df(-5,0,0) ; 22 | cp[1] = Point3Df(0,0,-5) ; 23 | cp[2] = Point3Df(3,0,10) ; 24 | cp[3] = Point3Df(5,0,0) ; 25 | 26 | C.globalInterp(cp,3) ; 27 | 28 | // generates a surface by sweeping 29 | 30 | PlNurbsSurfacef S ; 31 | 32 | S.sweep(T,C,5) ; 33 | S.writeVRML("tnsSweepA.wrl",redColor,20,50) ; 34 | 35 | 36 | C.makeCircle(Point3Df(0,0,0),Point3Df(1,0,0),Point3Df(0,0,1),5,0,1.5*M_PI) ; 37 | S.sweep(T,C,8) ; 38 | S.writeVRML("tnsSweepB.wrl",blueColor,20,50) ; 39 | 40 | S.writeRIB("test.rib",Color(30,255,200),Point3Df(0,1,0)) ; 41 | 42 | 43 | // create a scaling function 44 | 45 | PlNurbsCurvef scale ; 46 | 47 | Vector_Point3Df scaleP(3) ; 48 | 49 | scaleP[0] = Point3Df(1,1,1) ; 50 | scaleP[1] = Point3Df(0.5,0.5,2.0) ; 51 | scaleP[2] = Point3Df(1,1,1) ; 52 | 53 | scale.globalInterp(scaleP,2) ; 54 | 55 | S.sweep(T,C,scale,5,0) ; 56 | 57 | S.writeVRML("tnsSweepC.wrl",greenColor,20,50) ; 58 | 59 | 60 | S.sweep(T,C,scale,5,0) ; 61 | S.writeVRML("tnsSweepC.wrl",greenColor,20,50) ; 62 | 63 | S.sweep(T,C,5,1,0) ; 64 | S.writeVRML("tnsSweepD.wrl",greenColor,20,50) ; 65 | 66 | 67 | C.makeCircle(Point3Df(0,0,0),Point3Df(1,0,0),Point3Df(0,0,1),1,-M_PI/4.0,M_PI/3.0) ; 68 | S.makeFromRevolution(C,Point3Df(0,0,0),Point3Df(0,0,1)) ; 69 | S.writeVRML("tnsSweepE.wrl",Color(255,0,255),20,30) ; 70 | S.write("tnsSweepE.ns") ; 71 | 72 | cout << "The results of the sweep test can be viewed in:\n" << 73 | "\t tnsSweepA.wrl\n\t tnsSweepB.wrl\n\t tnsSweepC.wrl\n\t tnsSweepD.wrl\n" ; 74 | cout << "In tnsSweepE.wrl, you'll see a surface of revolution\n" ; 75 | return 0 ; 76 | } 77 | -------------------------------------------------------------------------------- /matrix/vector_float.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(float),compareFloat) ; 32 | } 33 | 34 | 35 | #ifdef NO_IMPLICIT_TEMPLATES 36 | 37 | template class Vector ; 38 | 39 | template Vector operator+(const Vector&, const Vector&); 40 | template Vector operator-(const Vector&, const Vector&); 41 | template float operator*(const Vector&,const Vector&); 42 | template Vector operator*(const Vector& v, const double d); 43 | template Vector operator*(const double d,const Vector& v); 44 | template Vector operator*(const Vector& v, const Complex d); 45 | template int operator==(const Vector&,const Vector&); 46 | template int operator!=(const Vector&,const Vector&); 47 | 48 | #endif 49 | 50 | } 51 | -------------------------------------------------------------------------------- /matrix/vector_float.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(float),compareFloat) ; 32 | } 33 | 34 | 35 | #ifdef NO_IMPLICIT_TEMPLATES 36 | 37 | template class Vector ; 38 | 39 | template Vector operator+(const Vector&, const Vector&); 40 | template Vector operator-(const Vector&, const Vector&); 41 | template float operator*(const Vector&,const Vector&); 42 | template Vector operator*(const Vector& v, const double d); 43 | template Vector operator*(const double d,const Vector& v); 44 | template Vector operator*(const Vector& v, const Complex d); 45 | template int operator==(const Vector&,const Vector&); 46 | template int operator!=(const Vector&,const Vector&); 47 | 48 | #endif 49 | 50 | } 51 | -------------------------------------------------------------------------------- /examples/nurbs/tnurbsSub.cpp: -------------------------------------------------------------------------------- 1 | #include "nurbsSub.h" 2 | 3 | namespace PLib { 4 | 5 | template 6 | NurbsSurface* generateTorus(T majorRadius, T minorRadius) 7 | { 8 | // These define the shape of a unit torus centered about the origin. 9 | T xvalues[] = { 0.0, -1.0, -1.0, -1.0, 0.0, 1.0, 1.0, 1.0, 0.0 }; 10 | T yvalues[] = { 1.0, 1.0, 0.0, -1.0, -1.0, -1.0, 0.0, 1.0, 1.0 }; 11 | T zvalues[] = { 0.0, 1.0, 1.0, 1.0, 0.0, -1.0, -1.0, -1.0, 0.0 }; 12 | T offsets[] = { -1.0, -1.0, 0.0, 1.0, 1.0, 1.0, 0.0, -1.0, -1.0 }; 13 | 14 | // Piecewise Bezier knot vector for a quadratic curve with four segments 15 | T knotsMem[] = { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4 }; 16 | Vector knots(knotsMem,12) ; 17 | 18 | int i, j; 19 | 20 | double r2over2 = sqrt( 2.0 ) / 2.0; 21 | double weight; 22 | 23 | NurbsSurface *torus = new NurbsSurface ; 24 | 25 | torus->resize(9,9,2,2) ; 26 | 27 | for (i = 0; i < 9; i++){ 28 | for (j = 0; j < 9; j++) { 29 | HPoint_nD hp ; 30 | weight = ((j & 1) ? r2over2 : 1.0) * ((i & 1) ? r2over2 : 1.0); 31 | // Notice how the weights are pre-multiplied with the x, y and z values 32 | hp.x() = xvalues[j]* (majorRadius + offsets[i] * minorRadius) * weight; 33 | hp.y() = yvalues[j]* (majorRadius + offsets[i] * minorRadius) * weight; 34 | hp.z() = (zvalues[i] * minorRadius) * weight; 35 | hp.w() = weight; 36 | torus->modCP(i,j,hp) ; 37 | } 38 | } 39 | 40 | // The knot vectors define piecewise Bezier segments 41 | // (the same in both U and V). 42 | 43 | torus->modKnotU(knots) ; 44 | torus->modKnotV(knots) ; 45 | 46 | return torus; 47 | } 48 | 49 | template NurbsSurface* generateTorus(float majorRadius, float minorRadius); 50 | 51 | } 52 | 53 | main() 54 | { 55 | using namespace PLib ; 56 | NurbsSurface *torus; 57 | 58 | float tolerance = 2.0; 59 | 60 | torus = generateTorus( 1.3, 0.3 ); 61 | 62 | NurbsSubSurface surf(*torus) ; 63 | 64 | surf.drawSubdivisionPS("tnurbsSub.ps", tolerance ); 65 | surf.drawSubdivisionVRML("tnurbsSub.wrl",0.1) ; 66 | surf.drawSubdivisionVRML97("tnurbsSub97.wrl",0.1) ; 67 | } 68 | -------------------------------------------------------------------------------- /matrix/vector_double.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(float),compareDouble) ; 32 | } 33 | 34 | 35 | 36 | #ifdef NO_IMPLICIT_TEMPLATES 37 | 38 | template class Vector ; 39 | 40 | template Vector operator+(const Vector&, const Vector&); 41 | template Vector operator-(const Vector&, const Vector&); 42 | template double operator*(const Vector&,const Vector&); 43 | template Vector operator*(const Vector& v, const double d); 44 | template Vector operator*(const double d,const Vector& v); 45 | template Vector operator*(const Vector& v, const Complex d); 46 | template int operator==(const Vector&,const Vector&); 47 | template int operator!=(const Vector&,const Vector&); 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /matrix/vector_double.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: vector.cpp 3 | Purpose: 4 | Revision: $Id: vector_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "vector.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Vector::qSortStd(){ 31 | qsort((char*)memory(),n(),sizeof(float),compareDouble) ; 32 | } 33 | 34 | 35 | 36 | #ifdef NO_IMPLICIT_TEMPLATES 37 | 38 | template class Vector ; 39 | 40 | template Vector operator+(const Vector&, const Vector&); 41 | template Vector operator-(const Vector&, const Vector&); 42 | template double operator*(const Vector&,const Vector&); 43 | template Vector operator*(const Vector& v, const double d); 44 | template Vector operator*(const double d,const Vector& v); 45 | template Vector operator*(const Vector& v, const Complex d); 46 | template int operator==(const Vector&,const Vector&); 47 | template int operator!=(const Vector&,const Vector&); 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /matrix/matrix_float.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrix.cpp 3 | Purpose: 4 | Revision: $Id: matrix_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "matrix.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Matrix::qSort(){ 31 | qsort((char*)m,rows()*cols(),sizeof(float),compareFloat) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Matrix ; 37 | 38 | template Matrix operator+(const Matrix&,const Matrix&); 39 | template Matrix operator-(const Matrix&,const Matrix&); 40 | template Matrix operator*(const Matrix&,const Matrix&); 41 | template Matrix operator*(const double,const Matrix&); 42 | template Matrix operator*(const Complex&,const Matrix&); 43 | template Vector operator*(const Matrix&,const Vector&); 44 | template int operator==(const Matrix&,const Matrix&); 45 | //template int operator!=(const Matrix&,const Matrix&); 46 | template Matrix comm(const Matrix&,const Matrix&); 47 | 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /matrix/matrix_float.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrix.cpp 3 | Purpose: 4 | Revision: $Id: matrix_float.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "matrix.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Matrix::qSort(){ 31 | qsort((char*)m,rows()*cols(),sizeof(float),compareFloat) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Matrix ; 37 | 38 | template Matrix operator+(const Matrix&,const Matrix&); 39 | template Matrix operator-(const Matrix&,const Matrix&); 40 | template Matrix operator*(const Matrix&,const Matrix&); 41 | template Matrix operator*(const double,const Matrix&); 42 | template Matrix operator*(const Complex&,const Matrix&); 43 | template Vector operator*(const Matrix&,const Vector&); 44 | template int operator==(const Matrix&,const Matrix&); 45 | //template int operator!=(const Matrix&,const Matrix&); 46 | template Matrix comm(const Matrix&,const Matrix&); 47 | 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /matrix/matrix_double.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrix.cpp 3 | Purpose: 4 | Revision: $Id: matrix_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "matrix.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Matrix::qSort(){ 31 | qsort((char*)m,rows()*cols(),sizeof(double),compareDouble) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Matrix ; 37 | 38 | template Matrix operator+(const Matrix&,const Matrix&); 39 | template Matrix operator-(const Matrix&,const Matrix&); 40 | template Matrix operator*(const Matrix&,const Matrix&); 41 | template Matrix operator*(const double,const Matrix&); 42 | template Matrix operator*(const Complex&,const Matrix&); 43 | template Vector operator*(const Matrix&,const Vector&); 44 | template int operator==(const Matrix&,const Matrix&); 45 | //template int operator!=(const Matrix&,const Matrix&); 46 | template Matrix comm(const Matrix&,const Matrix&); 47 | 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /matrix/matrix_double.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: matrix.cpp 3 | Purpose: 4 | Revision: $Id: matrix_double.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "matrix.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> void Matrix::qSort(){ 31 | qsort((char*)m,rows()*cols(),sizeof(double),compareDouble) ; 32 | } 33 | 34 | #ifdef NO_IMPLICIT_TEMPLATES 35 | 36 | template class Matrix ; 37 | 38 | template Matrix operator+(const Matrix&,const Matrix&); 39 | template Matrix operator-(const Matrix&,const Matrix&); 40 | template Matrix operator*(const Matrix&,const Matrix&); 41 | template Matrix operator*(const double,const Matrix&); 42 | template Matrix operator*(const Complex&,const Matrix&); 43 | template Vector operator*(const Matrix&,const Vector&); 44 | template int operator==(const Matrix&,const Matrix&); 45 | //template int operator!=(const Matrix&,const Matrix&); 46 | template Matrix comm(const Matrix&,const Matrix&); 47 | 48 | 49 | #endif 50 | 51 | } 52 | -------------------------------------------------------------------------------- /image/filter_.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: filter.cpp 3 | Purpose: 4 | Revision: $Id: filter_.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (18 February 1999) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "filter.cpp" 27 | 28 | namespace PLib { 29 | 30 | namespace Filter{ 31 | 32 | #ifdef NO_IMPLICIT_TEMPLATES 33 | template void median(const Basic2DArray& a, Basic2DArray& b); 34 | template void median(const Basic2DArray& a, Basic2DArray& b); 35 | template void median(const Basic2DArray& a, Basic2DArray& b); 36 | template void median(const Basic2DArray& a, Basic2DArray& b); 37 | template void median(const Basic2DArray& a, Basic2DArray& b); 38 | 39 | template void medianT(const Basic2DArray& a, Basic2DArray& b, int, int); 40 | template void medianT(const Basic2DArray& a, Basic2DArray& b, float, int); 41 | template void medianT(const Basic2DArray& a, Basic2DArray& b, double, int); 42 | template void medianT(const Basic2DArray& a, Basic2DArray& b, char, int); 43 | template void medianT(const Basic2DArray& a, Basic2DArray& b, unsigned char, int); 44 | 45 | #endif 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /examples/nurbs/tnurbs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // testing of interpolation and approximation 4 | 5 | int main(){ 6 | int i ; 7 | // Initialize a NURBS curve and generate a list of points from it 8 | int deg = 3 ; 9 | Vector_HPoint3Df P(10) ; 10 | 11 | using namespace PLib ; 12 | 13 | P[0] = HPoint3Df(30,30,0,1) ; 14 | P[1] = HPoint3Df(40,60,0,1) ; 15 | P[2] = HPoint3Df(80,60,0,1) ; 16 | P[3] = HPoint3Df(60,160,0,1) ; 17 | P[4] = HPoint3Df(100,80,0,1) ; 18 | P[5] = HPoint3Df(120,50,0,1) ; 19 | P[6] = HPoint3Df(120,50,0,1) ; 20 | P[7] = HPoint3Df(120,50,0,1) ; 21 | P[8] = HPoint3Df(160,90,0,1) ; 22 | P[9] = HPoint3Df(200,200,0,1) ; 23 | 24 | Vector_FLOAT U(10+deg+1) ; 25 | for(i=0;i ostream& 31 | BasicArray::print(ostream& os) const{ 32 | const int iend = size(); 33 | 34 | for (int i = 0; i < iend; ) 35 | { 36 | os << real(x[i]) << "+" << imag(x[i]) << "i" ; // << endl; 37 | if ( (++i % wdth) == 0 ) 38 | os << '\n'; 39 | else 40 | os << " "; 41 | } 42 | os << '\n' ; 43 | 44 | return os; 45 | } 46 | 47 | #ifdef NO_IMPLICIT_TEMPLATES 48 | template class BasicArray ; 49 | template void resizeBasicArray(BasicArray&,int) ; 50 | template int operator!=(const BasicArray&,const BasicArray&); 51 | template int operator==(const BasicArray&,const BasicArray&); 52 | template istream& operator>>(istream& is, BasicArray& ary); 53 | template ostream& operator<<(ostream& os, const BasicArray& ary); 54 | 55 | #endif 56 | 57 | } 58 | 59 | #ifdef NO_IMPLICIT_TEMPLATES 60 | template double std::abs(const std::complex &); 61 | template Complex std::conj(const Complex&); 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /matrix/barray_complex.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray.cpp 3 | Purpose: 4 | Revision: $Id: barray_complex.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> ostream& 31 | BasicArray::print(ostream& os) const{ 32 | const int iend = size(); 33 | 34 | for (int i = 0; i < iend; ) 35 | { 36 | os << real(x[i]) << "+" << imag(x[i]) << "i" ; // << endl; 37 | if ( (++i % wdth) == 0 ) 38 | os << '\n'; 39 | else 40 | os << " "; 41 | } 42 | os << '\n' ; 43 | 44 | return os; 45 | } 46 | 47 | #ifdef NO_IMPLICIT_TEMPLATES 48 | template class BasicArray ; 49 | template void resizeBasicArray(BasicArray&,int) ; 50 | template int operator!=(const BasicArray&,const BasicArray&); 51 | template int operator==(const BasicArray&,const BasicArray&); 52 | template istream& operator>>(istream& is, BasicArray& ary); 53 | template ostream& operator<<(ostream& os, const BasicArray& ary); 54 | 55 | #endif 56 | 57 | } 58 | 59 | #ifdef NO_IMPLICIT_TEMPLATES 60 | template double std::abs(const std::complex &); 61 | template Complex std::conj(const Complex&); 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /matrix/barray2d_uchar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_uchar.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> ostream& 31 | Basic2DArray::print(ostream& os) const 32 | { 33 | int i, j; 34 | const int r = rows() ; 35 | const int c = cols(); 36 | 37 | if ( by_columns ) 38 | for (j = 0; j < c; j++) 39 | { 40 | for (i = 0; i < r; i++) { 41 | os << setw(width) << (int)elem(i,j) << ' '; 42 | } 43 | os << '\n'; 44 | } 45 | else 46 | for (i = 0; i < r; i++) 47 | { 48 | for (j = 0; j < c; j++){ 49 | os << setw(width) << (int)elem(i,j) << ' '; 50 | } 51 | os << '\n'; 52 | } 53 | 54 | return os; 55 | } 56 | 57 | 58 | 59 | #ifdef NO_IMPLICIT_TEMPLATES 60 | 61 | template class Basic2DArray ; 62 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 63 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 64 | template istream& operator>>(istream& is, Basic2DArray& ary); 65 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 66 | 67 | 68 | #endif 69 | 70 | } 71 | -------------------------------------------------------------------------------- /nurbs++-config.1: -------------------------------------------------------------------------------- 1 | .TH cppunit 1 "September 2001" 2 | .SH NAME 3 | nurbs++-config - script to get information about the installed version of nurbs++ 4 | .SH SYNOPSIS 5 | .B nurbs++-config 6 | [\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags] 7 | .SH DESCRIPTION 8 | .PP 9 | \fInurbs++-config\fP is a tool that is used to configure to determine 10 | the compiler and linker flags that should be used to compile and link 11 | programs that use \fInurbs++\fP. It is also used internally to the .m4 12 | macros for GNU autoconf that are included with \fInurbs++\fP. 13 | . 14 | .SH OPTIONS 15 | .l 16 | \fInurbs++-config\fP accepts the following options: 17 | .TP 8 18 | .B \-\-version 19 | Print the currently installed version of \fInurbs++\fP on the standard 20 | output. 21 | .TP 8 22 | .B \-\-libs 23 | Print the linker flags that are necessary to link a \fInurbs++\fP 24 | program. 25 | .TP 8 26 | .B \-\-cflags 27 | Print the compiler flags that are necessary to compile a \fInurbs++\fP 28 | program. 29 | .TP 8 30 | .B \-\-prefix 31 | Print the prefix with which \fInurbs++\fP was compiled. 32 | .TP 8 33 | .B \-\-prefix=PREFIX 34 | If specified, use PREFIX instead of the installation prefix that 35 | \fInurbs++\fP was built with when computing the output for the 36 | \-\-cflags and \-\-libs options. This option is also used for the exec 37 | prefix if \-\-exec\-prefix was not specified. This option must be 38 | specified before any \-\-libs or \-\-cflags options. 39 | .TP 8 40 | .B \-\-exec\-prefix 41 | Print the exec\-prefix with which \fInurbs++\fP was compiled. 42 | .TP 8 43 | .B \-\-exec\-prefix=PREFIX 44 | If specified, use PREFIX instead of the installation exec prefix that 45 | \fInurbs++\fP was built with when computing the output for the 46 | \-\-cflags and \-\-libs options. This option must be specified before 47 | any \-\-libs or \-\-cflags options. 48 | .SH COPYRIGHT 49 | NURBS++ Copyright \(co 1996-2002 by Philppe Lavoie 50 | .PP 51 | This software is under the LGPL. You can find a copy of the LGPL 52 | somewhere on the net, most likely at http://www.gnu.org. 53 | .SH AUTHOR 54 | This manpage is an almost word-for-word copy of the cppunit-config 55 | which in turn is an almost word-for-word copy of the gtk-config 56 | manpage, written by Owen Taylor. It was modified by Philippe Lavoie 57 | . 58 | -------------------------------------------------------------------------------- /matrix/barray2d_uchar.cpp.orig: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_uchar.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | template <> ostream& 31 | Basic2DArray::print(ostream& os) const 32 | { 33 | int i, j; 34 | const int r = rows() ; 35 | const int c = cols(); 36 | 37 | if ( by_columns ) 38 | for (j = 0; j < c; j++) 39 | { 40 | for (i = 0; i < r; i++) { 41 | os << setw(width) << (int)elem(i,j) << ' '; 42 | } 43 | os << '\n'; 44 | } 45 | else 46 | for (i = 0; i < r; i++) 47 | { 48 | for (j = 0; j < c; j++){ 49 | os << setw(width) << (int)elem(i,j) << ' '; 50 | } 51 | os << '\n'; 52 | } 53 | 54 | return os; 55 | } 56 | 57 | 58 | 59 | #ifdef NO_IMPLICIT_TEMPLATES 60 | 61 | template class Basic2DArray ; 62 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 63 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 64 | template istream& operator>>(istream& is, Basic2DArray& ary); 65 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 66 | 67 | 68 | #endif 69 | 70 | } 71 | -------------------------------------------------------------------------------- /numerical/integrate.h: -------------------------------------------------------------------------------- 1 | #ifndef MATRIX_INTEGRATE_H 2 | #define MATRIX_INTEGRATE_H 3 | 4 | #include "barray.h" 5 | 6 | /*! 7 | */ 8 | namespace PLib { 9 | 10 | template void cdft(int n, T wr, T wi, BasicArray &a) ; 11 | template void rdft(int n, T wr, T wi, BasicArray &a) ; 12 | template void ddct(int n, T wr, T wi, BasicArray &a) ; 13 | template void ddst(int n, T wr, T wi, BasicArray &a) ; 14 | template void dfct(int n, T wr, T wi, BasicArray &a) ; 15 | template void dfst(int n, T wr, T wi, BasicArray &a) ; 16 | 17 | 18 | template void chebexp(double (*f)(T), T a, T b, T eps, 19 | BasicArray &c, T &err) ; 20 | template void chebexp(double (*f)(T,void*), void*, T a, T b, 21 | T eps, BasicArray &c, T &err) ; 22 | template T chebeval(T x, const BasicArray &c) ; 23 | 24 | 25 | template void intccini(BasicArray &w) ; 26 | 27 | 28 | template 29 | struct ClassPO { 30 | virtual T operator()(T a) =0; 31 | }; 32 | 33 | template 34 | struct ClassPOvoid { 35 | virtual T operator()(T a, void*) =0; 36 | }; 37 | 38 | // POPtr is a pointer to a class that defines the operator()(T) 39 | // Using ClassPO as a base class is a good idea as they are instantiated 40 | // in the source file 41 | 42 | 43 | template T integrate(POPtr f, T a, T b, T eps, int n, T &err) ; 44 | template T intcc(POPtr f, T a, T b, T eps, BasicArray &w, T &err); 45 | template T integrate2(POPtr f, T a, T b, T eps, int n, T &err) ; 46 | template T intcc2(POPtr f, T a, T b, T eps, BasicArray w, T &err); 47 | 48 | 49 | // POvPtr is a pointer to a class that defines the operator()(T,void*) 50 | // Using ClassPOvoid as a base class is a good idea as they are instantiated 51 | // in the source file 52 | 53 | template T integrate(POvPtr f,void*, T a, T b, T eps, int n, T &err) ; 54 | template T intcc(POvPtr,void*, T a, T b, T eps, BasicArray &w, T &err) ; 55 | template T integrate2(POvPtr f,void*, T a, T b, T eps, int n, T &err) ; 56 | template T intcc2(POvPtr,void*, T a, T b, T eps, BasicArray w, T &err) ; 57 | 58 | } 59 | 60 | #ifdef INCLUDE_TEMPLATE_SOURCE 61 | #include "fft.cpp" 62 | #include "chebexp.cpp" 63 | #include "intccq.cpp" 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /matrix/list.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: list.cpp 3 | Purpose: 4 | Revision: $Id: list.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (28 October 1997) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #include "list.h" 26 | 27 | #ifdef NO_IMPLICIT_TEMPLATES 28 | 29 | template class BasicNode ; 30 | template class BasicNode ; 31 | template class BasicNode ; 32 | template class BasicNode ; 33 | template class BasicNode ; 34 | template class BasicNode ; 35 | template class BasicNode ; 36 | template class BasicNode ; 37 | template class BasicNode ; 38 | template class BasicNode ; 39 | template class BasicNode ; 40 | template class BasicNode ; 41 | template class BasicNode ; 42 | template class BasicNode ; 43 | 44 | template class BasicList ; 45 | template class BasicList ; 46 | template class BasicList ; 47 | template class BasicList ; 48 | template class BasicList ; 49 | template class BasicList ; 50 | template class BasicList ; 51 | template class BasicList ; 52 | template class BasicList ; 53 | template class BasicList ; 54 | template class BasicList ; 55 | template class BasicList ; 56 | template class BasicList ; 57 | template class BasicList ; 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /matrix/matrix_global.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: global.h 3 | Purpose: Define and include some general definitions valid for all 4 | matrix header files 5 | Revision: $Id: matrix_global.h,v 1.5 2002/05/24 17:08:34 philosophil Exp $ 6 | Created by: Philippe Lavoie (3 Oct, 1996) 7 | Modified by: 8 | 9 | Copyright notice: 10 | Copyright (C) 1996-1998 Philippe Lavoie 11 | 12 | This library is free software; you can redistribute it and/or 13 | modify it under the terms of the GNU Library General Public 14 | License as published by the Free Software Foundation; either 15 | version 2 of the License, or (at your option) any later version. 16 | 17 | This library is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | Library General Public License for more details. 21 | 22 | You should have received a copy of the GNU Library General Public 23 | License along with this library; if not, write to the Free 24 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | =============================================================================*/ 26 | #ifndef _Matrix_Global_h_ 27 | #define _Matrix_Global_h_ 28 | 29 | #undef PACKAGE 30 | #undef VERSION 31 | 32 | #include "plib.h" 33 | 34 | #undef PACKAGE 35 | #undef VERSION 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | using std::cerr; 45 | using std::cout; 46 | using std::cin; 47 | using std::endl; 48 | using std::setw; 49 | using std::real; 50 | using std::imag; 51 | using std::complex; 52 | using std::ostream; 53 | using std::istream; 54 | using std::ofstream; 55 | using std::ifstream; 56 | 57 | #ifdef USING_VCC 58 | namespace PLib { 59 | const double M_PI = 3.1415926535897932385; 60 | } 61 | #endif 62 | 63 | 64 | //#ifdef __GNUG__ 65 | //typedef double_complex Complex ; 66 | //#else 67 | typedef std::complex Complex ; 68 | 69 | 70 | #ifndef HAS_COMPLEX_CONJ 71 | Complex conj(Complex &value){ 72 | return Complex(value.real(),-value.imag()); 73 | } 74 | #endif 75 | 76 | #ifndef HAS_COMPLEX_ABS 77 | double abs(Complex &value){ 78 | return sqrt(value.real()*value.real()+value.imag()*value.imag()); 79 | } 80 | #endif 81 | 82 | 83 | //#ifdef __sgi 84 | //inline Complex operator*(double a1, Complex a2) 85 | //{ 86 | // return Complex(a1*real(a2), a1*imag(a2)); 87 | //} 88 | //#endif 89 | //#endif 90 | 91 | #include "error.h" 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /nurbs/tri_spline.h: -------------------------------------------------------------------------------- 1 | /*===================================================================== 2 | File: nurbs.cpp 3 | Purpose: 4 | Revision: $Id: tri_spline.h,v 1.2 2002/05/13 21:07:46 philosophil Exp $ 5 | Author: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =====================================================================*/ 25 | #ifndef _TRIANGULAR_BSPLINE_H 26 | #define _TRIANGULAR_BSPLINE_H 27 | 28 | #include "nurbs_global.h" 29 | 30 | #include "point_nd.h" 31 | #include "hpoint_nd.h" 32 | #include "barray.h" 33 | 34 | #include "nurbsS.h" 35 | 36 | /*! 37 | */ 38 | namespace PLib { 39 | 40 | template 41 | class TriangularBSpline { 42 | private: 43 | BasicArray > cp; 44 | int deg ; 45 | public: 46 | TriangularBSpline(int degree); 47 | Point_nD& b(int i, int j, int); 48 | Point_nD b(int, int ,int) const ; 49 | Point_nD operator()(T u, T v) const; 50 | 51 | }; 52 | 53 | template 54 | class RTriangularBSpline { 55 | private: 56 | BasicArray > cp; 57 | int deg ; 58 | public: 59 | RTriangularBSpline(int degree); 60 | HPoint_nD& b(int, int, int); 61 | HPoint_nD b(int, int ,int) const ; 62 | HPoint_nD operator()(T u, T v) const; 63 | 64 | int writeVRML(const char* filename, const Color& color=whiteColor, int Nu=20, int Nv=20, int Nw=20) const; 65 | int writeVRML(ostream& fout, const Color& color=whiteColor, int Nu=20, int Nv=20, int Nw=20) const; 66 | 67 | void setDegree(int d) ; 68 | }; 69 | 70 | template < class T, int D> void convert(const NurbsSurface& surf, RTriangularBSpline &t1, RTriangularBSpline &t2) ; 71 | 72 | } 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /examples/nurbs/tnInterp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | int i ; 6 | cout << "Testing NURBS interpolation and approximation\n" ; 7 | 8 | Vector_Point3Df points(10) ; 9 | 10 | points[0] = Point3Df(20,20,0) ; 11 | points[1] = Point3Df(20,80,0) ; 12 | points[2] = Point3Df(20,120,0) ; 13 | points[3] = Point3Df(20,160,0) ; 14 | points[4] = Point3Df(80,200,0) ; 15 | points[5] = Point3Df(120,200,0) ; 16 | points[6] = Point3Df(160,160,0) ; 17 | points[7] = Point3Df(160,120,0) ; 18 | points[8] = Point3Df(120,80,0) ; 19 | points[9] = Point3Df(80,80,0) ; 20 | 21 | 22 | Vector_Point3Df deriv(10) ; 23 | deriv[0] = Point3Df(0,1,0) ; 24 | deriv[1] = Point3Df(0,1,0) ; 25 | deriv[2] = Point3Df(0,1,0) ; 26 | deriv[3] = Point3Df(0,1,0) ; 27 | deriv[4] = Point3Df(1,0,0) ; 28 | deriv[5] = Point3Df(1,0,0) ; 29 | deriv[6] = Point3Df(0,-1,0) ; 30 | deriv[7] = Point3Df(0,-1,0) ; 31 | deriv[8] = Point3Df(-1,0,0) ; 32 | deriv[9] = Point3Df(-1,0,0) ; 33 | 34 | PlNurbsCurvef curveA,curveB,curveC,curveD; 35 | 36 | curveA.globalInterp(points,3) ; 37 | curveB.leastSquares(points,3,5) ; 38 | curveC.leastSquares(points,3,8) ; 39 | curveD.globalInterpD(points,deriv,3,1) ; 40 | 41 | curveA.writePSp("tnInterpA.ps", points, Vector< Point_nD >(), 1, 2.0); 42 | curveB.writePSp("tnInterpB.ps", points, Vector< Point_nD >(), 1, 2.0); 43 | curveC.writePSp("tnInterpC.ps", points, Vector< Point_nD >(), 1, 2.0); 44 | curveD.writePSp("tnInterpD.ps", points, Vector< Point_nD >(), 1, 2.0); 45 | 46 | #ifdef WITH_IMAGE_MAGICK 47 | IM_ColorImage result ; 48 | 49 | result.resize(250,250) ; 50 | result.reset(Color(255,255,255)) ; 51 | 52 | 53 | cout << "The global interpolation result is represented in white.\n" ; 54 | curveA.drawImg(result,Color(255,255,255),0.001) ; 55 | cout << "The least squares approximation with 5 points is in cyan.\n" ; 56 | curveB.drawImg(result,Color(0,255,255),0.001) ; 57 | cout << "The least squares approximation with 8 points is in blue.\n" ; 58 | curveC.drawImg(result,Color(0,0,255),0.001) ; 59 | cout << "The global interpolation with the 1st derivative specified is in yellow.\n" ; 60 | curveD.drawImg(result,Color(255,255,0),0.001) ; 61 | 62 | cout << "The points are in red.\n" ; 63 | for(i=0;i 2 | #include 3 | #include 4 | 5 | int main(){ 6 | Matrix_Point3Df Pts(4,5) ; 7 | int i,j ; 8 | 9 | using namespace PLib ; 10 | 11 | 12 | for(i=0;i sub(surf) ; 43 | sub.drawSubdivisionVRML("tnurbsSb.wrl",0.5); 44 | 45 | surf.writeVRML("tnurbsS2.wrl",Color(255,255,0),float(0.1)) ; 46 | 47 | 48 | NurbsCurvef curve ; 49 | curve.makeCircle(Point3Df(0.5,0.5,0),0.3); 50 | 51 | 52 | Vector_Point3Df pnt(100) ; 53 | 54 | for(i=0;i<100;++i){ 55 | Point3Df param = curve.pointAt(float(i)/99.0) ; 56 | pnt[i] = surf.pointAt(param.x(),param.y()); 57 | } 58 | 59 | NurbsCurvef curve2 ; 60 | 61 | curve2.globalInterp(pnt,3) ; 62 | 63 | ofstream fout ; 64 | 65 | fout.open("tnurbsST.wrl"); 66 | surf.writeVRML(fout,Color(255,255,255)) ; 67 | 68 | curve2.writeVRML(fout,0.1,30,Color(255,0,0),6,60) ; 69 | 70 | curve.writeVRML(fout,0.1,30,Color(0,255,0),6,60) ; 71 | 72 | curve.degreeElevate(7) ; 73 | 74 | for(i=0;i 31 | #include "vector.h" 32 | 33 | namespace PLib { 34 | 35 | /*! 36 | \class CVector cvector.h matrix/cvector.h 37 | \brief A circular vector class 38 | 39 | A circular vector class based on the vector class. 40 | The usefullness is limited since you can't perform 41 | mathematical operators with these vectors and obtain 42 | meaningfull results. 43 | 44 | \author Philippe Lavoie 45 | \date 4 October 1996 46 | */ 47 | template class CVector : public Vector 48 | { 49 | public: 50 | CVector() : Vector(), index(0) {;} 51 | CVector(const int r) : Vector(r), index(0) {;} 52 | CVector(const CVector& v) : Vector(v), index(v.index) {;} 53 | CVector(const Vector& v) : Vector(v), index(0) {;} 54 | CVector(const BasicArray& v) : Vector(v), index(0) {;} 55 | virtual ~CVector() {} 56 | 57 | T& operator[](const int i) { return this->x[i%this->sze]; } 58 | T operator[](const int i) const { return this->x[i%this->sze]; } 59 | 60 | void put(T v) { this->x[index] = v ; index = (index+1)%this->sze; } 61 | 62 | protected: 63 | int index ; 64 | 65 | }; 66 | 67 | } // end namespace 68 | 69 | typedef PLib::CVector CVector_INT ; 70 | typedef PLib::CVector CVector_BYTE ; 71 | typedef PLib::CVector CVector_FLOAT ; 72 | typedef PLib::CVector CVector_DOUBLE ; 73 | typedef PLib::CVector CVector_UBYTE ; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /matrix/cvector.h.orig: -------------------------------------------------------------------------------- 1 | /*===================================================================== 2 | File: cvector.h 3 | Purpose: 4 | Revision: $Id: cvector.h,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | Copyright notice: 8 | Copyright (C) 1996-1998 Philippe Lavoie 9 | 10 | This library is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Library General Public 12 | License as published by the Free Software Foundation; either 13 | version 2 of the License, or (at your option) any later version. 14 | 15 | This library is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Library General Public License for more details. 19 | 20 | You should have received a copy of the GNU Library General Public 21 | License along with this library; if not, write to the Free 22 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 | =====================================================================*/ 24 | 25 | #ifndef _Matrix_cvector_h_ 26 | #define _Matrix_cvector_h_ 27 | 28 | 29 | 30 | #include 31 | #include "vector.h" 32 | 33 | namespace PLib { 34 | 35 | /*! 36 | \class CVector cvector.h matrix/cvector.h 37 | \brief A circular vector class 38 | 39 | A circular vector class based on the vector class. 40 | The usefullness is limited since you can't perform 41 | mathematical operators with these vectors and obtain 42 | meaningfull results. 43 | 44 | \author Philippe Lavoie 45 | \date 4 October 1996 46 | */ 47 | template class CVector : public Vector 48 | { 49 | public: 50 | CVector() : Vector(), index(0) {;} 51 | CVector(const int r) : Vector(r), index(0) {;} 52 | CVector(const CVector& v) : Vector(v), index(v.index) {;} 53 | CVector(const Vector& v) : Vector(v), index(0) {;} 54 | CVector(const BasicArray& v) : Vector(v), index(0) {;} 55 | virtual ~CVector() {} 56 | 57 | T& operator[](const int i) { return this->x[i%this->sze]; } 58 | T operator[](const int i) const { return this->x[i%this->sze]; } 59 | 60 | void put(T v) { this->x[index] = v ; index = (index+1)%this->sze; } 61 | 62 | protected: 63 | int index ; 64 | 65 | }; 66 | 67 | } // end namespace 68 | 69 | typedef PLib::CVector CVector_INT ; 70 | typedef PLib::CVector CVector_BYTE ; 71 | typedef PLib::CVector CVector_FLOAT ; 72 | typedef PLib::CVector CVector_DOUBLE ; 73 | typedef PLib::CVector CVector_UBYTE ; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /examples/nurbs/tnsMovePoint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | int i,j ; 6 | 7 | // Let's generate a simple test surface 8 | 9 | Matrix_Point3Df pts(6,6) ; 10 | 11 | for(i=0;i keepPts(4) ; 28 | 29 | D[0] = Point3Df(0,0,0.7) ; 30 | D[1] = Point3Df(0,3,0) ; 31 | ur[0] = 0.5 ; 32 | ur[1] = 0.6 ; 33 | vr[0] = 0.5 ; 34 | Dur[0] = 0 ; 35 | Dvr[0] = 0 ; 36 | Duk[0] = 0 ; 37 | Dvk[0] = 0 ; 38 | Dur[1] = 0 ; 39 | Dvr[1] = 0 ; 40 | Duk[1] = 0 ; 41 | Dvk[1] = 1 ; 42 | 43 | keepPts[0] = Coordinate(1,1) ; 44 | keepPts[1] = Coordinate(5,5) ; 45 | keepPts[2] = Coordinate(5,1) ; 46 | keepPts[3] = Coordinate(1,5) ; 47 | 48 | cout << "Point at (0.5,0.5) is " << surf.pointAt(0.5,0.5) << endl ; 49 | if(!surf.movePoint(ur,vr,D,Dur,Dvr,Duk,Dvk,keepPts)){ 50 | cout << "Ill defined problem!\n" ; 51 | } ; 52 | 53 | cout << "after modification it is " << surf.pointAt(0.5,0.5) << endl ; 54 | 55 | surf.writeVRML("tnsMovePointA.wrl",Color(0,0,255)) ; 56 | 57 | surf.write("tngl.ns"); 58 | 59 | 60 | PlNurbsSurfacef surf2(surf) ; 61 | PlNurbsSurfacef surf3(surf) ; 62 | 63 | cout << "Before (0.3,0.6) = " << surf(0.3,0.6) << endl ; 64 | surf.movePoint(0.3,0.6,Point3Df(-0.1,-0.1,-0.1)) ; 65 | Vector_Point3Df d(1) ; 66 | d[0] = Point3Df(-0.1,-0.1,-0.1) ; 67 | Vector_FLOAT uk(1),vk(1) ; 68 | uk[0] = 0.3 ; 69 | vk[0] = 0.6 ; 70 | Vector_INT du(1),dv(1) ; 71 | du[0] = 0 ; 72 | dv[0] = 0 ; 73 | PLib::BasicArray fix(4) ; 74 | 75 | Vector_INT di(1),dj(1) ; 76 | di[0] = 0 ; 77 | dj[0] = 0 ; 78 | 79 | fix[0] = Coordinate(2,2) ; 80 | fix[1] = Coordinate(0,3) ; 81 | fix[2] = Coordinate(1,4) ; 82 | fix[3] = Coordinate(2,5) ; 83 | 84 | surf2.movePoint(uk,vk,d,du,dv,di,dj,fix) ; 85 | 86 | cout << "After (0.3,0.6) = " << surf(0.3,0.6) << endl ; 87 | cout << "After (0.3,0.6) = " << surf2(0.3,0.6) << endl ; 88 | 89 | 90 | cout << "surf P =\n" << surf.ctrlPnts()-surf3.ctrlPnts() << endl << endl ; 91 | cout << "surf2 P =\n" << surf2.ctrlPnts()-surf3.ctrlPnts() << endl << endl ; 92 | 93 | 94 | surf.write("tnglB.ns") ; 95 | 96 | surf2.writeVRML("tnsMovePointB.wrl",Color(0,0,255)) ; 97 | cout << "You can view the before/after view of the surface in\n" ; 98 | cout << "\ttnsMovePointA.wrl and tnsMovePointB.wrl\n" ; 99 | } 100 | -------------------------------------------------------------------------------- /examples/nurbs/tclose.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace PLib ; 4 | 5 | 6 | int main(){ 7 | using namespace PLib ; 8 | int deg = 3 ; 9 | 10 | //using namespace PLib ; 11 | 12 | Vector_HPoint3Df P(10) ; 13 | 14 | P[0] = HPoint3Df(70,50,0,1) ; 15 | P[1] = HPoint3Df(100,60,0,1) ; 16 | P[2] = HPoint3Df(110,120,0,1) ; 17 | P[3] = HPoint3Df(100,150,0,1) ; 18 | P[4] = HPoint3Df(180,150,0,1) ; 19 | P[5] = HPoint3Df(200,200,0,1) ; 20 | P[6] = HPoint3Df(80,190,0,1) ; 21 | P[7] = HPoint3Df(60,100,0,1) ; 22 | P[8] = HPoint3Df(50,70,0,1) ; 23 | P[9] = P[0] ; 24 | 25 | PlNurbsCurvef curve1 ; 26 | PlNurbsCurvef curve2 ; 27 | 28 | curve1.globalInterpH(P,deg) ; 29 | 30 | cout << "U1= " << curve1.knot() << endl ; 31 | cout << "P1 = " << curve1.ctrlPnts() << endl ; 32 | cout << "D1 = " << curve1.degree() << endl ; 33 | 34 | P.resize(9); // the closed loop routine doesn't need P[0] = P[last] 35 | 36 | Vector_HPoint3Df Pw ; 37 | wrapPointVectorH(P,deg,Pw); 38 | curve2.globalInterpClosedH(Pw,deg) ; 39 | 40 | 41 | cout << "U2 = " << curve2.knot() << endl ; 42 | cout << "P2 = " << curve2.ctrlPnts() << endl ; 43 | cout << "D2 = " << curve2.degree() << endl ; 44 | 45 | #ifdef WITH_IMAGE_MAGICK 46 | IM_ColorImage image ; 47 | image.resize(256,256) ; 48 | 49 | curve1.drawImg(image,Color(0,0,255),0.01) ; 50 | curve2.drawImg(image,Color(0,255,0),0.01) ; 51 | 52 | image.write("closed.png"); 53 | #endif 54 | 55 | cout << "\nPrinting the result to tnClose.ps\n" ; 56 | curve2.writePS("tnClosedA.ps",1,2.0,5,false) ; 57 | 58 | cout << "Clamping the curve in c2.\n" ; 59 | 60 | curve1 = curve2 ; 61 | curve1.clamp(); 62 | 63 | cout << "Testing if it worked: c1(0) = " << curve2(0) << endl ; 64 | cout << " c2(0) = " << curve1(0) << endl ; 65 | cout << " c1(0.01) = " << curve2(0.01) << endl ; 66 | cout << " c2(0.01) = " << curve1(0.01) << endl ; 67 | cout << " c1(1) = " << curve2(1) << endl ; 68 | cout << " c2(1) = " << curve1(1) << endl ; 69 | 70 | cout << "The clamped curve is printed inside tnClosedB.ps\n" ; 71 | curve1.writePS("tnClosedB.ps",1,2.0,5,true) ; 72 | 73 | 74 | cout << "\nThe c2 curve is now unclamped.\n" ; 75 | curve1.unclamp() ; 76 | cout << "Testing if it worked: c2(0) = " << curve1(0) << endl ; 77 | cout << " c2(0.01) = " << curve1(0.01) << endl ; 78 | cout << " c2(1) = " << curve1(1) << endl ; 79 | cout << "The unclamped curve is printed inside tnClosedC.ps\n" ; 80 | curve1.writePS("tnClosedC.ps",1,2.0,5,false) ; 81 | 82 | cout << "If you see a difference between the Postscript files,"; 83 | cout << "\nsomething went wrong.\n\n" ; 84 | cout << "Done testing the closed NURBS curve functions.\n" ; 85 | 86 | 87 | return 0; 88 | 89 | } 90 | -------------------------------------------------------------------------------- /numerical/statistic.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: statistic.h 3 | Purpose: 4 | Revision: $Id: statistic.h,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (22 Oct, 1997) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #ifndef _matrix_statistic_hh 26 | #define _matrix_statistic_hh 27 | 28 | #include "barray.h" 29 | 30 | /*! 31 | */ 32 | namespace PLib { 33 | 34 | void initStatistic(); 35 | 36 | extern int MaximumIterations ; 37 | 38 | template 39 | inline T Precision(){ 40 | return 0 ; 41 | } 42 | 43 | template <> inline double Precision() { return 3e-7 ; } 44 | template <> inline float Precision() { return 3e-7 ; } 45 | 46 | template 47 | inline T MinimumFloat(){ 48 | return 0 ; 49 | } 50 | 51 | template <> inline double MinimumFloat() { return 1e-30 ; } 52 | template <> inline float MinimumFloat() { return 1e-30 ; } 53 | 54 | template T lnOfGamma(T xx) ; 55 | template T factorial(int n) ; 56 | template T lnOfFactorial(int n) ; 57 | template T binomialCoefficient(int n, int k) ; 58 | template T beta(T z, T w) ; 59 | template T gammaP(T a, T x); 60 | template T gammaQ(T a, T x); 61 | template T gammaSerie(T a, T x, T& gln) ; 62 | template T gammaSerieCF(T a, T x, T& gln) ; 63 | template T errorFcn(T x); 64 | template T errorFcnC(T x); 65 | template T errorFcnChebyshevC(T x); 66 | template void kendallTau(const BasicArray& data1, const BasicArray& data2, T &tau, T &z, T& prob); 67 | 68 | void kendallTau(const BasicArray& data1, const BasicArray& data2, float &tau, float &z, float& prob); 69 | void kendallTau(const BasicArray& data1, const BasicArray& data2, double &tau, double &z, double& prob); 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /nurbs/hnurbs.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: hnurbsS.h 3 | Purpose: 4 | Revision: $Id: hnurbs.h,v 1.2 2002/05/13 21:07:46 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | #ifndef _nurbs_hnurbs_h_ 26 | #define _nurbs_hnurbs_h_ 27 | 28 | #include "nurbs.h" 29 | 30 | class PlHNurbsCurveNode ; 31 | 32 | class PlHNurbsCurve : public PlParaCurve { 33 | public: 34 | PlHNurbsCurve() ; 35 | virtual ~PlHNurbsCurve() { reset() ; } 36 | 37 | void add(const PlNurbsCurve& curve, T uS, T uE) ; 38 | void remove(void) ; 39 | void reset(void) ; 40 | 41 | T minKnot() const { return 0.0 ; } 42 | T maxKnot() const { return 1.0 ; } 43 | 44 | HPoint_nD operator()(T u) const; 45 | void deriveAt(T u, int, PlVector< HPoint_nD >&) const; 46 | void deriveAt(T u, int, PlVector< Point_nD >&) const; 47 | 48 | void interpolate(const PlVector< Point_nD > &Pts, int deg, T acceptError=0.5, int nSample=100, int maxTries=100, int nInitPoints=-1, int nPoints=-1); 49 | 50 | void draw(Image_Color& img, const Color& col) const ; 51 | void draw(Image_UBYTE& img, unsigned char col) const ; 52 | private: 53 | PlHNurbsCurveNode *first, *last ; 54 | }; 55 | 56 | class PlHNurbsCurveNode: public PlParaCurve{ 57 | public: 58 | T &u0, &u1 ; 59 | 60 | 61 | PlHNurbsCurveNode *prev,*next ; 62 | PlNurbsCurve *curve ; 63 | 64 | PlHNurbsCurveNode() ; 65 | PlHNurbsCurveNode(const PlNurbsCurve& c, T uS, T uE) ; 66 | 67 | 68 | T minKnot() const { return u0_ ; } 69 | T maxKnot() const { return u1_ ; } 70 | 71 | HPoint_nD operator()(T u) const; 72 | void deriveAt(T u, int, PlVector< HPoint_nD >&) const; 73 | void deriveAt(T u, int, PlVector< Point_nD >&) const; 74 | 75 | protected: 76 | T u0_,u1_ ; 77 | T uD ; 78 | }; 79 | 80 | 81 | #endif // _nurbs_hnurbs_h_ 82 | -------------------------------------------------------------------------------- /numerical/statistic_.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: statistics.cpp 3 | Purpose: 4 | Revision: $Id: statistic_.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (18 February 1999) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "statistic.cpp" 27 | 28 | namespace PLib{ 29 | 30 | int MaximumIterations ; 31 | 32 | #ifdef NO_IMPLICIT_TEMPLATES 33 | 34 | template float lnOfGamma(float xx) ; 35 | template float factorial(int n) ; 36 | template float lnOfFactorial(int n) ; 37 | template float binomialCoefficient(int n, int k) ; 38 | template float beta(float z, float w) ; 39 | template float gammaP(float a, float x); 40 | template float gammaQ(float a, float x); 41 | template float gammaSerie(float a, float x, float& gln) ; 42 | template float gammaSerieCF(float a, float x, float& gln) ; 43 | template float errorFcn(float x); 44 | template float errorFcnC(float x); 45 | template float errorFcnChebyshevC(float x); 46 | template void kendallTau(const BasicArray& data1, const BasicArray& data2, float &tau, float &z, float& prob); 47 | 48 | template double lnOfGamma(double xx) ; 49 | template double factorial(int n) ; 50 | template double lnOfFactorial(int n) ; 51 | template double binomialCoefficient(int n, int k) ; 52 | template double beta(double z, double w) ; 53 | template double gammaP(double a, double x); 54 | template double gammaQ(double a, double x); 55 | template double gammaSerie(double a, double x, double& gln) ; 56 | template double gammaSerieCF(double a, double x, double& gln) ; 57 | template double errorFcn(double x); 58 | template double errorFcnC(double x); 59 | template double errorFcnChebyshevC(double x); 60 | template void kendallTau(const BasicArray& data1, const BasicArray& data2, double &tau, double &z, double& prob); 61 | 62 | #endif 63 | 64 | } 65 | -------------------------------------------------------------------------------- /matrix/barray2d_point.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray2d.cpp 3 | Purpose: 4 | Revision: $Id: barray2d_point.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1997 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | #include "barray2d.cpp" 27 | 28 | namespace PLib { 29 | 30 | #ifdef NO_IMPLICIT_TEMPLATES 31 | 32 | template class Basic2DArray ; 33 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 34 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 35 | template istream& operator>>(istream& is, Basic2DArray& ary); 36 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 37 | 38 | 39 | template class Basic2DArray ; 40 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 41 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 42 | template istream& operator>>(istream& is, Basic2DArray& ary); 43 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 44 | 45 | 46 | template class Basic2DArray ; 47 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 48 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 49 | template istream& operator>>(istream& is, Basic2DArray& ary); 50 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 51 | 52 | 53 | template class Basic2DArray ; 54 | template void initBasic2DArray(Basic2DArray&,const int,const int) ; 55 | template void resizeKeepBasic2DArray(Basic2DArray&,const int,const int) ; 56 | template istream& operator>>(istream& is, Basic2DArray& ary); 57 | template ostream& operator<<(ostream& os, const Basic2DArray& ary); 58 | 59 | 60 | #endif 61 | 62 | } 63 | -------------------------------------------------------------------------------- /examples/nurbs/trispline.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | using namespace PLib ; 5 | TriangularBSpline ts(4) ; 6 | 7 | ts.b(0,0,4) = Point_nD(0,0,0) ; 8 | ts.b(1,0,3) = Point_nD(1,0,0) ; 9 | ts.b(2,0,2) = Point_nD(2,0,1) ; 10 | ts.b(3,0,1) = Point_nD(3,0,2) ; 11 | ts.b(4,0,0) = Point_nD(4,0,0) ; 12 | 13 | ts.b(0,1,3) = Point_nD(0.5,1,1) ; 14 | ts.b(1,1,2) = Point_nD(1.5,1,1) ; 15 | ts.b(2,1,1) = Point_nD(2.5,1,0) ; 16 | ts.b(3,1,0) = Point_nD(3.5,1,1) ; 17 | 18 | ts.b(0,2,2) = Point_nD(1,2,0) ; 19 | ts.b(1,2,1) = Point_nD(2,2,2) ; 20 | ts.b(2,2,0) = Point_nD(3,2,-1) ; 21 | 22 | ts.b(0,3,1) = Point_nD(1.5,3,1) ; 23 | ts.b(1,3,0) = Point_nD(2.5,3,3) ; 24 | 25 | ts.b(0,4,0) = Point_nD(2,4,0) ; 26 | 27 | 28 | cout << "Point at (0.5,0.5) = " << ts(0.5,0.5) << endl ; 29 | cout << "Point at (0.333,0.333) = " << ts(0.333,0.333) << endl ; 30 | 31 | RTriangularBSpline rts(4) ; 32 | 33 | rts.b(0,0,4) = HPoint_nD(0,0,0,1) ; 34 | rts.b(1,0,3) = HPoint_nD(1,0,0,1) ; 35 | rts.b(2,0,2) = HPoint_nD(2,0,1,1) ; 36 | rts.b(3,0,1) = HPoint_nD(3,0,2,1) ; 37 | rts.b(4,0,0) = HPoint_nD(4,0,0,1) ; 38 | 39 | rts.b(0,1,3) = HPoint_nD(0.5,1,1,1) ; 40 | rts.b(1,1,2) = HPoint_nD(1.5,1,1,1) ; 41 | rts.b(2,1,1) = HPoint_nD(2.5,1,0,1) ; 42 | rts.b(3,1,0) = HPoint_nD(3.5,1,1,1) ; 43 | 44 | rts.b(0,2,2) = HPoint_nD(1,2,0,1) ; 45 | rts.b(1,2,1) = HPoint_nD(2,2,2,1) ; 46 | rts.b(2,2,0) = HPoint_nD(3,2,-1,1) ; 47 | 48 | rts.b(0,3,1) = HPoint_nD(1.5,3,1,1) ; 49 | rts.b(1,3,0) = HPoint_nD(2.5,3,3,1) ; 50 | 51 | rts.b(0,4,0) = HPoint_nD(2,4,0,1) ; 52 | 53 | cout << "HPoint at (0.5,0.5) = " << rts(0.5,0.5) << endl ; 54 | cout << "HPoint at (0.333,0.333) = " << rts(0.333,0.333) << endl ; 55 | 56 | 57 | cout << " You can view the triangular B-Spline in trispline.wrl\n" ; 58 | cout << std::flush ; 59 | 60 | rts.writeVRML("trispline.wrl"); 61 | 62 | cout << " Now testing the conversion between NURBS surfaces and triangular B-Splines\n" ; 63 | 64 | NurbsSurface surf ; 65 | surf.makeSphere(Point_nD(0,0,0),2.0) ; 66 | 67 | NurbsSurfaceArray sa ; 68 | 69 | surf.decompose(sa) ; 70 | 71 | ofstream fout ; 72 | 73 | fout.open("triconvert.wrl"); 74 | 75 | for(int i=0;i t1(4), t2(4) ; 77 | 78 | convert(sa[i],t1,t2) ; 79 | 80 | t1.writeVRML(fout,Color(255,0,0)) ; 81 | t2.writeVRML(fout,Color(0,0,255)) ; 82 | } 83 | 84 | fout.close(); 85 | 86 | cout << "You can view a sphere converted into multiple triangular B-splines in triconvert.wrl\n" ; 87 | 88 | } 89 | -------------------------------------------------------------------------------- /examples/vc6/numericlib/numericlib.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="numericlib" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Static Library" 0x0104 6 | 7 | CFG=numericlib - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "numericlib.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "numericlib.mak" CFG="numericlib - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "numericlib - Win32 Release" (based on "Win32 (x86) Static Library") 21 | !MESSAGE "numericlib - Win32 Debug" (based on "Win32 (x86) Static Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "numericlib - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 45 | # ADD BASE RSC /l 0x807 /d "NDEBUG" 46 | # ADD RSC /l 0x807 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LIB32=link.exe -lib 51 | # ADD BASE LIB32 /nologo 52 | # ADD LIB32 /nologo 53 | 54 | !ELSEIF "$(CFG)" == "numericlib - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 67 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 68 | # ADD BASE RSC /l 0x807 /d "_DEBUG" 69 | # ADD RSC /l 0x807 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LIB32=link.exe -lib 74 | # ADD BASE LIB32 /nologo 75 | # ADD LIB32 /nologo 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "numericlib - Win32 Release" 82 | # Name "numericlib - Win32 Debug" 83 | # Begin Group "Source Files" 84 | 85 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 86 | # End Group 87 | # Begin Group "Header Files" 88 | 89 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 90 | # End Group 91 | # End Target 92 | # End Project 93 | -------------------------------------------------------------------------------- /matrix/barray_point.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | File: barray_point.cpp 3 | Purpose: 4 | Revision: $Id: barray_point.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $ 5 | Created by: Philippe Lavoie (3 Oct, 1996) 6 | Modified by: 7 | 8 | Copyright notice: 9 | Copyright (C) 1996-1998 Philippe Lavoie 10 | 11 | This library is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU Library General Public 13 | License as published by the Free Software Foundation; either 14 | version 2 of the License, or (at your option) any later version. 15 | 16 | This library is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | Library General Public License for more details. 20 | 21 | You should have received a copy of the GNU Library General Public 22 | License along with this library; if not, write to the Free 23 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | =============================================================================*/ 25 | 26 | 27 | 28 | #include "barray.cpp" 29 | 30 | namespace PLib { 31 | 32 | #ifdef NO_IMPLICIT_TEMPLATES 33 | 34 | template class BasicArray ; 35 | template void resizeBasicArray(BasicArray&,int) ; 36 | template int operator!=(const BasicArray&,const BasicArray&); 37 | template int operator==(const BasicArray&,const BasicArray&); 38 | template istream& operator>>(istream& is, BasicArray& ary); 39 | template ostream& operator<<(ostream& os, const BasicArray& ary); 40 | 41 | template class BasicArray ; 42 | template void resizeBasicArray(BasicArray&,int) ; 43 | template int operator!=(const BasicArray&,const BasicArray&); 44 | template int operator==(const BasicArray&,const BasicArray&); 45 | template istream& operator>>(istream& is, BasicArray& ary); 46 | template ostream& operator<<(ostream& os, const BasicArray& ary); 47 | 48 | template class BasicArray ; 49 | template void resizeBasicArray(BasicArray&,int) ; 50 | template int operator!=(const BasicArray&,const BasicArray&); 51 | template int operator==(const BasicArray&,const BasicArray&); 52 | template istream& operator>>(istream& is, BasicArray& ary); 53 | template ostream& operator<<(ostream& os, const BasicArray& ary); 54 | 55 | template class BasicArray ; 56 | template void resizeBasicArray(BasicArray&,int) ; 57 | template int operator!=(const BasicArray&,const BasicArray&); 58 | template int operator==(const BasicArray&,const BasicArray&); 59 | template istream& operator>>(istream& is, BasicArray& ary); 60 | template ostream& operator<<(ostream& os, const BasicArray& ary); 61 | 62 | #endif 63 | 64 | } 65 | -------------------------------------------------------------------------------- /examples/numerical/tmatrixMat.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const double MaxRandom = 32768 ; // 2^15 5 | 6 | using namespace PLib ; 7 | 8 | int main(){ 9 | 10 | // generating a random matrix 11 | 12 | Matrix_DOUBLE m(6,6) ; 13 | int i,j ; 14 | for(i=0;i LU ; 22 | Vector pivot ; 23 | 24 | int e ; 25 | LU.decompose(m) ; 26 | Matrix inv = LU.inverse() ; 27 | 28 | cout << "The LU factorization of m is\n\n" << LU << endl ; 29 | cout << "gives the inverse as\n\n" << LU.inverse() << endl ; 30 | cout << "Computing the error as m-inverse(inverse(m)) gives:\n\n" ; 31 | LU.decompose(inv) ; 32 | cout << m-LU.inverse() << endl ; 33 | 34 | cout << endl << endl; 35 | cout << "Trying to solve the following equations:\n" ; 36 | cout << "\t 3a + 9b + 4c - d + 8e = 15\n" ; 37 | cout << "\t10a + 9b + 4c + 8d +15e = 115 \n" ; 38 | cout << "\t 4a + 7b + 5c + 3d + 2e = 54\n" ; 39 | cout << "\t 9a - 3b + 7c + 5d + 6e = 121\n"; 40 | cout << "\t 7a +19b - 4c +40d + 3e = 282\n" ; 41 | cout << "\t -a + b +11c + 2d +13e = 90\n" ; 42 | cout << "We write the equation as A X = B (where X is the unknown matrix)\n"; 43 | 44 | Matrix A,B,X ; 45 | 46 | A.resize(6,5) ; 47 | 48 | double am[30] = {3, 9, 4, -1, 8, 10, 9, 4, 8, 15, 4, 7, 5, 3, 2,9,-3,7,5,6,7,19,-4,40,3,-1,1,11,2,13} ; 49 | for(i=0;i<6;++i) 50 | for(j=0;j<5;++j) 51 | A(i,j) = am[i*5+j] ; 52 | 53 | cout << "A =\n" << A ; 54 | 55 | B.resize(6,1) ; 56 | B(0,0) = 15 ; 57 | B(1,0) = 115 ; 58 | B(2,0) = 54 ; 59 | B(3,0) = 121 ; 60 | B(4,0) = 282 ; 61 | B(5,0) = 90 ; 62 | 63 | X.resize(5,1) ; 64 | 65 | SVDMatrix svd ; 66 | 67 | if(!svd.decompose(A)) 68 | cerr << "Found some singularities!\n" ; 69 | svd.solve(B,X) ; 70 | cout << "B=" << B << endl ; 71 | 72 | cout << "\nX =\n" << X ; 73 | cout << "The result should be 3, -2, 6, 8 and 1\n" ; 74 | 75 | //cout << "The error is X(computed)-X = " << X(0,0)-3.0 << ", " << X(1,0)+2.0 << ", " << X(2,0)-6.0 << ", " << X(3,0)-8.0 << ", " << X(4,0)-1.0 << endl ; 76 | 77 | cout << "The above result was obtained using SVD with an overdetermined set of equations.\n" ; 78 | cout << "Using only the first 5 elements, we can solve the system using\nLU decomposition.\n" ; 79 | 80 | cout << "B = " << B << endl ; 81 | A.resizeKeep(5,5) ; 82 | cout << "B(ok) = " << B << endl ; 83 | B.resizeKeep(5,1) ; 84 | cout << "B = " << B << endl ; 85 | LU.decompose(A) ; 86 | cout << "B2 = " << B << endl ; 87 | X = LU.inverse()*B ; 88 | cout << "B = " << B << endl ; 89 | 90 | cout << "test =\n" << A*LU.inverse() << endl ; 91 | 92 | cout << "And we obtain a new X equal to \n" << X << endl ; 93 | 94 | cout << "The new error is X(computed)-X = " << X(0,0)-3.0 << ", " << X(1,0)+2.0 << ", " << X(2,0)-6.0 << ", " << X(3,0)-8.0 << ", " << X(4,0)-1.0 << endl ; 95 | 96 | cout << "\nEnd of matrixMat testing.\n" ; 97 | 98 | return 0 ; 99 | } 100 | --------------------------------------------------------------------------------