├── .gitignore ├── README.md ├── gaps ├── LICENSE.txt ├── Makefile ├── README.txt ├── apps │ ├── Makefile │ ├── grd2grd │ │ ├── Makefile │ │ ├── grd2grd.cpp │ │ └── grd2grd.vcxproj │ ├── grd2msh │ │ ├── Makefile │ │ ├── grd2msh.cpp │ │ └── grd2msh.vcxproj │ ├── grd2pts │ │ ├── Makefile │ │ ├── grd2pts.cpp │ │ └── grd2pts.vcxproj │ ├── grd2txt │ │ ├── Makefile │ │ ├── grd2txt.cpp │ │ └── grd2txt.vcxproj │ ├── grdview │ │ ├── Makefile │ │ ├── grdview.cpp │ │ └── grdview.vcxproj │ ├── img2img │ │ ├── Makefile │ │ ├── img2img.cpp │ │ └── img2img.vcxproj │ ├── msh2grd │ │ ├── Makefile │ │ ├── msh2grd.cpp │ │ └── msh2grd.vcxproj │ ├── msh2msh │ │ ├── Makefile │ │ ├── msh2msh.cpp │ │ └── msh2msh.vcxproj │ ├── msh2prp │ │ ├── Makefile │ │ ├── msh2prp.cpp │ │ └── msh2prp.vcxproj │ ├── msh2pts │ │ ├── Makefile │ │ ├── msh2pts.cpp │ │ └── msh2pts.vcxproj │ ├── mshalign │ │ ├── Makefile │ │ ├── mshalign.cpp │ │ └── mshalign.vcxproj │ ├── mshinfo │ │ ├── Makefile │ │ ├── mshinfo.cpp │ │ └── mshinfo.vcxproj │ ├── mshview │ │ ├── Makefile │ │ ├── mshview.cpp │ │ └── mshview.vcxproj │ ├── pdb2grd │ │ ├── Makefile │ │ └── pdb2grd.cpp │ ├── pdb2msh │ │ ├── Makefile │ │ └── pdb2msh.cpp │ ├── pdb2pdb │ │ ├── Makefile │ │ └── pdb2pdb.cpp │ ├── pdbinfo │ │ ├── Makefile │ │ └── pdbinfo.cpp │ ├── pdbview │ │ ├── Makefile │ │ └── pdbview.cpp │ ├── pfm2pfm │ │ ├── Makefile │ │ └── pfm2pfm.cpp │ ├── pfminfo │ │ ├── Makefile │ │ └── pfminfo.cpp │ ├── pfmview │ │ ├── Makefile │ │ └── pfmview.cpp │ ├── prp2prp │ │ ├── Makefile │ │ ├── prp2prp.cpp │ │ └── prp2prp.vcxproj │ ├── prpview │ │ ├── Makefile │ │ ├── prpview.cpp │ │ └── prpview.vcxproj │ ├── ptsview │ │ ├── Makefile │ │ └── ptsview.cpp │ ├── scn2cam │ │ ├── Makefile │ │ └── scn2cam.cpp │ ├── scn2grd │ │ ├── Makefile │ │ └── scn2grd.cpp │ ├── scn2img │ │ ├── Makefile │ │ └── scn2img.cpp │ ├── scn2scn │ │ ├── Makefile │ │ └── scn2scn.cpp │ ├── scninfo │ │ ├── Makefile │ │ ├── scninfo.cpp │ │ └── scninfo.vcxproj │ ├── scnview │ │ ├── Makefile │ │ ├── scnview.cpp │ │ └── scnview.vcxproj │ ├── sfl2img │ │ ├── Makefile │ │ └── sfl2img.cpp │ ├── sfl2sfl │ │ ├── Makefile │ │ └── sfl2sfl.cpp │ ├── sflinfo │ │ ├── Makefile │ │ └── sflinfo.cpp │ ├── sflinit │ │ ├── Makefile │ │ └── sflinit.cpp │ ├── sflprocess │ │ ├── Makefile │ │ └── sflprocess.cpp │ └── sflview │ │ ├── Makefile │ │ ├── R3SurfelViewer.cpp │ │ ├── R3SurfelViewer.h │ │ ├── align.cpp │ │ ├── align.h │ │ ├── debug.cpp │ │ ├── debug.h │ │ ├── map.cpp │ │ ├── map.h │ │ ├── model.cpp │ │ └── sflview.cpp ├── docs │ ├── Makefile │ ├── headers │ │ ├── R2Shapes.header │ │ ├── R3Graphics.header │ │ ├── R3Shapes.header │ │ └── RNBasics.header │ ├── index.html │ ├── makeall │ ├── makepkg │ └── makepkg.awk ├── makefiles │ ├── Makefile.apps │ ├── Makefile.pkgs │ └── Makefile.std ├── pkgs │ ├── FET │ │ ├── FET.cpp │ │ ├── FET.h │ │ ├── FETCorrespondence.cpp │ │ ├── FETCorrespondence.h │ │ ├── FETDescriptor.cpp │ │ ├── FETDescriptor.h │ │ ├── FETFeature.cpp │ │ ├── FETFeature.h │ │ ├── FETMatch.cpp │ │ ├── FETMatch.h │ │ ├── FETReconstruction.cpp │ │ ├── FETReconstruction.h │ │ ├── FETShape.cpp │ │ ├── FETShape.h │ │ └── Makefile │ ├── Makefile │ ├── PDB │ │ ├── Makefile │ │ ├── PDB.cpp │ │ ├── PDB.h │ │ ├── PDBAminoAcid.cpp │ │ ├── PDBAminoAcid.h │ │ ├── PDBAtom.cpp │ │ ├── PDBAtom.h │ │ ├── PDBAtomTypes.cpp │ │ ├── PDBAtomTypes.h │ │ ├── PDBBond.cpp │ │ ├── PDBBond.h │ │ ├── PDBChain.cpp │ │ ├── PDBChain.h │ │ ├── PDBDistance.cpp │ │ ├── PDBDistance.h │ │ ├── PDBElement.cpp │ │ ├── PDBElement.h │ │ ├── PDBFile.cpp │ │ ├── PDBFile.h │ │ ├── PDBModel.cpp │ │ ├── PDBModel.h │ │ ├── PDBPick.cpp │ │ ├── PDBResidue.cpp │ │ ├── PDBResidue.h │ │ ├── PDBUtil.cpp │ │ ├── PDBUtil.h │ │ ├── amino_acid_atoms.txt │ │ └── charm22.txt │ ├── R2Shapes │ │ ├── Makefile │ │ ├── R2Affine.cpp │ │ ├── R2Affine.h │ │ ├── R2Align.cpp │ │ ├── R2Align.h │ │ ├── R2Arc.cpp │ │ ├── R2Arc.h │ │ ├── R2Box.cpp │ │ ├── R2Box.h │ │ ├── R2Circle.cpp │ │ ├── R2Circle.h │ │ ├── R2Cont.cpp │ │ ├── R2Cont.h │ │ ├── R2Crdsys.cpp │ │ ├── R2Crdsys.h │ │ ├── R2Curve.cpp │ │ ├── R2Curve.h │ │ ├── R2Diad.cpp │ │ ├── R2Diad.h │ │ ├── R2Dist.cpp │ │ ├── R2Dist.h │ │ ├── R2Draw.cpp │ │ ├── R2Draw.h │ │ ├── R2Grid.cpp │ │ ├── R2Grid.h │ │ ├── R2Halfspace.cpp │ │ ├── R2Halfspace.h │ │ ├── R2Image.cpp │ │ ├── R2Image.h │ │ ├── R2Io.cpp │ │ ├── R2Io.h │ │ ├── R2Isect.cpp │ │ ├── R2Isect.h │ │ ├── R2Kdtree.cpp │ │ ├── R2Kdtree.h │ │ ├── R2Line.cpp │ │ ├── R2Line.h │ │ ├── R2Parall.cpp │ │ ├── R2Parall.h │ │ ├── R2Perp.cpp │ │ ├── R2Perp.h │ │ ├── R2Point.cpp │ │ ├── R2Point.h │ │ ├── R2Polygon.cpp │ │ ├── R2Polygon.h │ │ ├── R2Polyline.cpp │ │ ├── R2Polyline.h │ │ ├── R2Ray.cpp │ │ ├── R2Ray.h │ │ ├── R2Relate.cpp │ │ ├── R2Relate.h │ │ ├── R2Shape.cpp │ │ ├── R2Shape.h │ │ ├── R2Shapes.cpp │ │ ├── R2Shapes.h │ │ ├── R2Shapes.vcxproj │ │ ├── R2Shapes.vcxproj.filters │ │ ├── R2Solid.cpp │ │ ├── R2Solid.h │ │ ├── R2Span.cpp │ │ ├── R2Span.h │ │ ├── R2Vector.cpp │ │ ├── R2Vector.h │ │ ├── R2Xform.cpp │ │ ├── R2Xform.h │ │ ├── R3Matrix.cpp │ │ └── R3Matrix.h │ ├── R3Graphics │ │ ├── Makefile │ │ ├── R2Texture.cpp │ │ ├── R2Texture.h │ │ ├── R2Viewport.cpp │ │ ├── R2Viewport.h │ │ ├── R3AreaLight.cpp │ │ ├── R3AreaLight.h │ │ ├── R3Brdf.cpp │ │ ├── R3Brdf.h │ │ ├── R3Camera.cpp │ │ ├── R3Camera.h │ │ ├── R3DirectionalLight.cpp │ │ ├── R3DirectionalLight.h │ │ ├── R3Frustum.cpp │ │ ├── R3Frustum.h │ │ ├── R3Graphics.cpp │ │ ├── R3Graphics.h │ │ ├── R3Graphics.vcxproj │ │ ├── R3Graphics.vcxproj.filters │ │ ├── R3Light.cpp │ │ ├── R3Light.h │ │ ├── R3Material.cpp │ │ ├── R3Material.h │ │ ├── R3PointLight.cpp │ │ ├── R3PointLight.h │ │ ├── R3Scene.cpp │ │ ├── R3Scene.h │ │ ├── R3SceneElement.cpp │ │ ├── R3SceneElement.h │ │ ├── R3SceneNode.cpp │ │ ├── R3SceneNode.h │ │ ├── R3SceneReference.cpp │ │ ├── R3SceneReference.h │ │ ├── R3SpotLight.cpp │ │ ├── R3SpotLight.h │ │ ├── R3Viewer.cpp │ │ ├── R3Viewer.h │ │ ├── json.cpp │ │ └── json.h │ ├── R3Shapes │ │ ├── Makefile │ │ ├── R3Affine.cpp │ │ ├── R3Affine.h │ │ ├── R3Align.cpp │ │ ├── R3Align.h │ │ ├── R3Base.cpp │ │ ├── R3Base.h │ │ ├── R3Box.cpp │ │ ├── R3Box.h │ │ ├── R3CatmullRomSpline.cpp │ │ ├── R3CatmullRomSpline.h │ │ ├── R3Circle.cpp │ │ ├── R3Circle.h │ │ ├── R3Cone.cpp │ │ ├── R3Cone.h │ │ ├── R3Cont.cpp │ │ ├── R3Cont.h │ │ ├── R3Crdsys.cpp │ │ ├── R3Crdsys.h │ │ ├── R3Curve.cpp │ │ ├── R3Curve.h │ │ ├── R3Cylinder.cpp │ │ ├── R3Cylinder.h │ │ ├── R3Dist.cpp │ │ ├── R3Dist.h │ │ ├── R3Draw.cpp │ │ ├── R3Draw.h │ │ ├── R3Ellipse.cpp │ │ ├── R3Ellipse.h │ │ ├── R3Ellipsoid.cpp │ │ ├── R3Ellipsoid.h │ │ ├── R3Grid.cpp │ │ ├── R3Grid.h │ │ ├── R3Halfspace.cpp │ │ ├── R3Halfspace.h │ │ ├── R3Isect.cpp │ │ ├── R3Isect.h │ │ ├── R3Kdtree.cpp │ │ ├── R3Kdtree.h │ │ ├── R3Line.cpp │ │ ├── R3Line.h │ │ ├── R3Mesh.cpp │ │ ├── R3Mesh.h │ │ ├── R3MeshProperty.cpp │ │ ├── R3MeshProperty.h │ │ ├── R3MeshPropertySet.cpp │ │ ├── R3MeshPropertySet.h │ │ ├── R3MeshSearchTree.cpp │ │ ├── R3MeshSearchTree.h │ │ ├── R3OrientedBox.cpp │ │ ├── R3OrientedBox.h │ │ ├── R3Parall.cpp │ │ ├── R3Parall.h │ │ ├── R3Perp.cpp │ │ ├── R3Perp.h │ │ ├── R3PlanarGrid.cpp │ │ ├── R3PlanarGrid.h │ │ ├── R3Plane.cpp │ │ ├── R3Plane.h │ │ ├── R3Point.cpp │ │ ├── R3Point.h │ │ ├── R3Polyline.cpp │ │ ├── R3Polyline.h │ │ ├── R3Quaternion.cpp │ │ ├── R3Quaternion.h │ │ ├── R3Ray.cpp │ │ ├── R3Ray.h │ │ ├── R3Rectangle.cpp │ │ ├── R3Rectangle.h │ │ ├── R3Relate.cpp │ │ ├── R3Relate.h │ │ ├── R3Shape.cpp │ │ ├── R3Shape.h │ │ ├── R3Shapes.cpp │ │ ├── R3Shapes.h │ │ ├── R3Shapes.vcxproj │ │ ├── R3Shapes.vcxproj.filters │ │ ├── R3Solid.cpp │ │ ├── R3Solid.h │ │ ├── R3Span.cpp │ │ ├── R3Span.h │ │ ├── R3Sphere.cpp │ │ ├── R3Sphere.h │ │ ├── R3Surface.cpp │ │ ├── R3Surface.h │ │ ├── R3Triad.cpp │ │ ├── R3Triad.h │ │ ├── R3Triangle.cpp │ │ ├── R3Triangle.h │ │ ├── R3TriangleArray.cpp │ │ ├── R3TriangleArray.h │ │ ├── R3Vector.cpp │ │ ├── R3Vector.h │ │ ├── R3Xform.cpp │ │ ├── R3Xform.h │ │ ├── R4Matrix.cpp │ │ ├── R4Matrix.h │ │ ├── ply.cpp │ │ └── ply.h │ ├── R3Surfels │ │ ├── Makefile │ │ ├── R3Surfel.cpp │ │ ├── R3Surfel.h │ │ ├── R3SurfelBlock.cpp │ │ ├── R3SurfelBlock.h │ │ ├── R3SurfelConstraint.cpp │ │ ├── R3SurfelConstraint.h │ │ ├── R3SurfelDatabase.cpp │ │ ├── R3SurfelDatabase.h │ │ ├── R3SurfelFeature.cpp │ │ ├── R3SurfelFeature.h │ │ ├── R3SurfelFeatureEvaluation.cpp │ │ ├── R3SurfelFeatureEvaluation.h │ │ ├── R3SurfelFeatureSet.cpp │ │ ├── R3SurfelFeatureSet.h │ │ ├── R3SurfelFeatureVector.cpp │ │ ├── R3SurfelFeatureVector.h │ │ ├── R3SurfelLabel.cpp │ │ ├── R3SurfelLabel.h │ │ ├── R3SurfelLabelAssignment.cpp │ │ ├── R3SurfelLabelAssignment.h │ │ ├── R3SurfelLabelProperty.cpp │ │ ├── R3SurfelLabelProperty.h │ │ ├── R3SurfelLabelRelationship.cpp │ │ ├── R3SurfelLabelRelationship.h │ │ ├── R3SurfelLabelSet.cpp │ │ ├── R3SurfelLabelSet.h │ │ ├── R3SurfelNode.cpp │ │ ├── R3SurfelNode.h │ │ ├── R3SurfelNodeSet.cpp │ │ ├── R3SurfelNodeSet.h │ │ ├── R3SurfelObject.cpp │ │ ├── R3SurfelObject.h │ │ ├── R3SurfelObjectProperty.cpp │ │ ├── R3SurfelObjectProperty.h │ │ ├── R3SurfelObjectRelationship.cpp │ │ ├── R3SurfelObjectRelationship.h │ │ ├── R3SurfelObjectSet.cpp │ │ ├── R3SurfelObjectSet.h │ │ ├── R3SurfelPoint.cpp │ │ ├── R3SurfelPoint.h │ │ ├── R3SurfelPointGraph.cpp │ │ ├── R3SurfelPointGraph.h │ │ ├── R3SurfelPointSet.cpp │ │ ├── R3SurfelPointSet.h │ │ ├── R3SurfelScan.cpp │ │ ├── R3SurfelScan.h │ │ ├── R3SurfelScene.cpp │ │ ├── R3SurfelScene.h │ │ ├── R3SurfelTree.cpp │ │ ├── R3SurfelTree.h │ │ ├── R3SurfelUtils.cpp │ │ ├── R3SurfelUtils.h │ │ ├── R3Surfels.cpp │ │ └── R3Surfels.h │ ├── RNBasics │ │ ├── Makefile │ │ ├── RNArray.I │ │ ├── RNArray.cpp │ │ ├── RNArray.h │ │ ├── RNBase.cpp │ │ ├── RNBase.h │ │ ├── RNBasics.cpp │ │ ├── RNBasics.h │ │ ├── RNBasics.vcxproj │ │ ├── RNBasics.vcxproj.filters │ │ ├── RNCompat.h │ │ ├── RNError.cpp │ │ ├── RNError.h │ │ ├── RNExtern.h │ │ ├── RNFile.cpp │ │ ├── RNFile.h │ │ ├── RNFlags.cpp │ │ ├── RNFlags.h │ │ ├── RNGrfx.I │ │ ├── RNGrfx.cpp │ │ ├── RNGrfx.h │ │ ├── RNHeap.cpp │ │ ├── RNHeap.h │ │ ├── RNIntval.cpp │ │ ├── RNIntval.h │ │ ├── RNMap.I │ │ ├── RNMap.cpp │ │ ├── RNMap.h │ │ ├── RNMem.cpp │ │ ├── RNMem.h │ │ ├── RNQueue.I │ │ ├── RNQueue.cpp │ │ ├── RNQueue.h │ │ ├── RNRgb.cpp │ │ ├── RNRgb.h │ │ ├── RNScalar.cpp │ │ ├── RNScalar.h │ │ ├── RNSvd.cpp │ │ ├── RNSvd.h │ │ ├── RNTime.cpp │ │ ├── RNTime.h │ │ ├── RNType.cpp │ │ └── RNType.h │ ├── RNMath │ │ ├── Makefile │ │ ├── RNAlgebraic.cpp │ │ ├── RNAlgebraic.h │ │ ├── RNDenseLUMatrix.cpp │ │ ├── RNDenseLUMatrix.h │ │ ├── RNDenseMatrix.cpp │ │ ├── RNDenseMatrix.h │ │ ├── RNEquation.cpp │ │ ├── RNEquation.h │ │ ├── RNLapack.h │ │ ├── RNMath.cpp │ │ ├── RNMath.h │ │ ├── RNMatrix.cpp │ │ ├── RNMatrix.h │ │ ├── RNPolynomial.cpp │ │ ├── RNPolynomial.h │ │ ├── RNSystemOfEquations.cpp │ │ ├── RNSystemOfEquations.h │ │ ├── RNVector.cpp │ │ └── RNVector.h │ ├── fglut │ │ ├── AUTHORS │ │ ├── Makefile │ │ ├── README │ │ ├── cygwin_config.h │ │ ├── fglut.c │ │ ├── fglut.h │ │ ├── fglut.sln │ │ ├── fglut.vcxproj │ │ ├── fglut.vcxproj.filters │ │ ├── freeglut.h │ │ ├── freeglut_callbacks.c │ │ ├── freeglut_cursor.c │ │ ├── freeglut_display.c │ │ ├── freeglut_ext.c │ │ ├── freeglut_ext.h │ │ ├── freeglut_font.c │ │ ├── freeglut_font_data.c │ │ ├── freeglut_gamemode.c │ │ ├── freeglut_geometry.c │ │ ├── freeglut_glutfont_definitions.c │ │ ├── freeglut_init.c │ │ ├── freeglut_input_devices.c │ │ ├── freeglut_internal.h │ │ ├── freeglut_joystick.c │ │ ├── freeglut_main.c │ │ ├── freeglut_menu.c │ │ ├── freeglut_misc.c │ │ ├── freeglut_overlay.c │ │ ├── freeglut_spaceball.c │ │ ├── freeglut_state.c │ │ ├── freeglut_std.h │ │ ├── freeglut_stroke_mono_roman.c │ │ ├── freeglut_stroke_roman.c │ │ ├── freeglut_structure.c │ │ ├── freeglut_teapot.c │ │ ├── freeglut_teapot_data.h │ │ ├── freeglut_videoresize.c │ │ ├── freeglut_window.c │ │ ├── glut.h │ │ ├── linux_config.h │ │ └── mac_config.h │ ├── gaps.h │ ├── jpeg │ │ ├── Makefile │ │ ├── README │ │ ├── jcapimin.c │ │ ├── jcapistd.c │ │ ├── jccoefct.c │ │ ├── jccolor.c │ │ ├── jcdctmgr.c │ │ ├── jchuff.c │ │ ├── jchuff.h │ │ ├── jcinit.c │ │ ├── jcmainct.c │ │ ├── jcmarker.c │ │ ├── jcmaster.c │ │ ├── jcomapi.c │ │ ├── jconfig.h │ │ ├── jcparam.c │ │ ├── jcphuff.c │ │ ├── jcprepct.c │ │ ├── jcsample.c │ │ ├── jctrans.c │ │ ├── jdapimin.c │ │ ├── jdapistd.c │ │ ├── jdatadst.c │ │ ├── jdatasrc.c │ │ ├── jdcoefct.c │ │ ├── jdcolor.c │ │ ├── jdct.h │ │ ├── jddctmgr.c │ │ ├── jdhuff.c │ │ ├── jdhuff.h │ │ ├── jdinput.c │ │ ├── jdmainct.c │ │ ├── jdmarker.c │ │ ├── jdmaster.c │ │ ├── jdmerge.c │ │ ├── jdphuff.c │ │ ├── jdpostct.c │ │ ├── jdsample.c │ │ ├── jdtrans.c │ │ ├── jerror.c │ │ ├── jerror.h │ │ ├── jfdctflt.c │ │ ├── jfdctfst.c │ │ ├── jfdctint.c │ │ ├── jidctflt.c │ │ ├── jidctfst.c │ │ ├── jidctint.c │ │ ├── jidctred.c │ │ ├── jinclude.h │ │ ├── jmemmgr.c │ │ ├── jmemnobs.c │ │ ├── jmemsys.h │ │ ├── jmorecfg.h │ │ ├── jpeg.vcxproj │ │ ├── jpeg.vcxproj.filters │ │ ├── jpegint.h │ │ ├── jpeglib.h │ │ ├── jquant1.c │ │ ├── jquant2.c │ │ ├── jutils.c │ │ ├── jversion.h │ │ └── libjpeg.doc │ └── png │ │ ├── Makefile │ │ ├── PNG-LICENSE.txt │ │ ├── PNG-README.txt │ │ ├── ZLIB_README.txt │ │ ├── adler32.c │ │ ├── compress.c │ │ ├── config.h │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── deflate.c │ │ ├── deflate.h │ │ ├── example.c │ │ ├── gzclose.c │ │ ├── gzguts.h │ │ ├── gzlib.c │ │ ├── gzread.c │ │ ├── gzwrite.c │ │ ├── infback.c │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── minigzip.c │ │ ├── png.c │ │ ├── png.h │ │ ├── png.vcxproj │ │ ├── png.vcxproj.filters │ │ ├── pngconf.h │ │ ├── pngerror.c │ │ ├── pngget.c │ │ ├── pngmem.c │ │ ├── pngpread.c │ │ ├── pngpriv.h │ │ ├── pngread.c │ │ ├── pngrio.c │ │ ├── pngrtran.c │ │ ├── pngrutil.c │ │ ├── pngset.c │ │ ├── pngtest.c │ │ ├── pngtrans.c │ │ ├── pngwio.c │ │ ├── pngwrite.c │ │ ├── pngwtran.c │ │ ├── pngwutil.c │ │ ├── trees.c │ │ ├── trees.h │ │ ├── uncompr.c │ │ ├── zconf.h │ │ ├── zlib.h │ │ ├── zutil.c │ │ └── zutil.h └── vc │ ├── Makefile │ ├── README.txt │ ├── glut │ ├── GL │ │ └── glut.h │ ├── README-win32.txt │ ├── glut.def │ ├── glut32.dll │ └── glut32.lib │ ├── makefiles │ ├── Makefile.apps │ ├── Makefile.pkgs │ └── Makefile.std │ └── vc.sln └── metadata ├── ModelCategoryMapping.csv ├── models.csv ├── opengl_lights.txt └── suncgModelLights.json /.gitignore: -------------------------------------------------------------------------------- 1 | gaps/pkgs/*/*.o 2 | gaps/apps/*/*.o 3 | gaps/lib/*/*.a 4 | gaps/bin/*/* 5 | -------------------------------------------------------------------------------- /gaps/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Thomas Funkhouser 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /gaps/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS 3 | # 4 | 5 | 6 | 7 | # 8 | # Make targets 9 | # 10 | 11 | opt: 12 | $(MAKE) target "TARGET=$@" 13 | 14 | debug: 15 | $(MAKE) target "TARGET=$@" 16 | 17 | mesa: 18 | $(MAKE) target "TARGET=$@" 19 | 20 | clean: 21 | $(MAKE) target "TARGET=$@" 22 | 23 | release: pkgs apps docs makefiles vc 24 | mkdir -p release 25 | cp README.txt release 26 | cp LICENSE.txt release 27 | cp Makefile release 28 | cp -r makefiles release 29 | $(MAKE) target "TARGET=$@" 30 | 31 | target: 32 | cd pkgs; $(MAKE) $(TARGET) 33 | cd apps; $(MAKE) $(TARGET) 34 | cd vc; $(MAKE) $(TARGET) 35 | # cd docs; $(MAKE) $(TARGET) 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/README.txt: -------------------------------------------------------------------------------- 1 | GAPS Users - 2 | 3 | This directory contains all code for the GAPS software library. 4 | There are several subdirectories: 5 | 6 | pkgs - source and include files for all packages (software libraries). 7 | apps - source files for several application and example programs. 8 | makefiles - unix-style make file definitions 9 | vc - visual studio solution files 10 | lib - archive library (.lib) files (created during compilation). 11 | bin - executable files (created during compilation). 12 | 13 | If you are using linux or cygwin and have gcc and OpenGL development 14 | libraries installed, or if you are using MAC OS X with the xcode 15 | development environment, you should be able to compile all the code by 16 | typing "make clean; make" in this directory. If you are using Windows 17 | Visual Studio 10 or later, then you should be able to open the 18 | solution file vc.sln in the vc subdirectory and then "Rebuild 19 | Solution." For other development platforms, you should edit the shared 20 | compilation settings in the makefiles/Makefiles.std to meet your needs. 21 | 22 | To write a program that uses the GAPS pkgs, then you should include 23 | "-I XXX/gaps/pkgs" in your compile flags (CFLAGS) and "-L 24 | XXX/gaps/lib" in your link flags (LDFLAGS), where XXX is the directory 25 | where you installed the gaps software. 26 | 27 | The software is distributed under the MIT license (see LICENSE.txt) 28 | and thus can be used for any purpose without warranty, any liability, 29 | or any suport of any kind. 30 | 31 | - Tom Funkhouser 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/apps/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS apps 3 | # 4 | 5 | opt: 6 | $(MAKE) target "TARGET=$@" 7 | 8 | debug: 9 | $(MAKE) target "TARGET=$@" 10 | 11 | mesa: 12 | $(MAKE) target "TARGET=$@" 13 | 14 | clean: 15 | $(MAKE) target "TARGET=$@" 16 | 17 | release: 18 | mkdir -p ../release/apps 19 | cp Makefile ../release/apps 20 | $(MAKE) target "TARGET=$@" 21 | 22 | target: 23 | cd img2img; $(MAKE) $(TARGET) 24 | cd msh2msh; $(MAKE) $(TARGET) 25 | cd msh2grd; $(MAKE) $(TARGET) 26 | cd msh2pts; $(MAKE) $(TARGET) 27 | cd msh2prp; $(MAKE) $(TARGET) 28 | cd mshalign; $(MAKE) $(TARGET) 29 | cd mshinfo; $(MAKE) $(TARGET) 30 | cd mshview; $(MAKE) $(TARGET) 31 | cd grdview; $(MAKE) $(TARGET) 32 | cd grd2grd; $(MAKE) $(TARGET) 33 | cd grd2msh; $(MAKE) $(TARGET) 34 | cd grd2pts; $(MAKE) $(TARGET) 35 | cd grd2txt; $(MAKE) $(TARGET) 36 | cd prp2prp; $(MAKE) $(TARGET) 37 | cd prpview; $(MAKE) $(TARGET) 38 | cd scninfo; $(MAKE) $(TARGET) 39 | cd scn2scn; $(MAKE) $(TARGET) 40 | cd scn2cam; $(MAKE) $(TARGET) 41 | cd scn2img; $(MAKE) $(TARGET) 42 | cd scnview; $(MAKE) $(TARGET) 43 | cd pfm2pfm; $(MAKE) $(TARGET) 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /gaps/apps/grd2grd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=grd2grd 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/grd2msh/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=grd2msh 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/apps/grd2pts/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=grd2pts 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/apps/grd2txt/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=grd2txt 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/grdview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=grdview 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -lfglut -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | -------------------------------------------------------------------------------- /gaps/apps/img2img/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name and list of source files. 3 | # 4 | 5 | NAME=img2img 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gaps/apps/img2img/img2img.cpp: -------------------------------------------------------------------------------- 1 | // Source file for the GLUT programs 2 | 3 | 4 | // RING include files 5 | 6 | #include "R2Shapes/R2Shapes.h" 7 | 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | // Check arguments 13 | if (argc != 3) { 14 | fprintf(stderr, "Usage: img2img inputfile outputfile\n"); 15 | return 1; 16 | } 17 | 18 | // Read and write image file 19 | R2Image image; 20 | if (!image.Read(argv[1])) return -1; 21 | if (!image.Write(argv[2])) return -1; 22 | return 0; 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gaps/apps/msh2grd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=msh2grd 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/msh2msh/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=msh2msh 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/msh2prp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=msh2prp 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/msh2pts/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=msh2pts 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/mshalign/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=mshalign 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/mshinfo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=mshinfo 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/mshview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=mshview 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/pdb2grd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pdb2grd 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lPDB -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/apps/pdb2msh/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pdb2msh 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lPDB -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/apps/pdb2pdb/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pdb2pdb 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lPDB -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/apps/pdbinfo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pdbinfo 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lPDB -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | -------------------------------------------------------------------------------- /gaps/apps/pdbview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pdbview 6 | 7 | 8 | 9 | # 10 | # Source files. 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lPDB -lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | -------------------------------------------------------------------------------- /gaps/apps/pfm2pfm/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pfm2pfm 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/pfminfo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name 3 | # 4 | 5 | NAME=pfminfo 6 | 7 | 8 | 9 | # 10 | # Source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp 14 | 15 | 16 | 17 | # 18 | # Libraries 19 | # 20 | 21 | PKG_LIBS=-lR2Shapes -lRNBasics -ljpeg -lpng 22 | 23 | 24 | 25 | # 26 | # Include standard makefile 27 | # 28 | 29 | include ../../makefiles/Makefile.apps 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/apps/pfminfo/pfminfo.cpp: -------------------------------------------------------------------------------- 1 | // Source file for the image info program 2 | 3 | 4 | 5 | // Include files 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | // Program variables 12 | 13 | static char *input_name = NULL; 14 | static int print_verbose = 0; 15 | 16 | 17 | 18 | static int 19 | PrintBasicInfo(const R2Grid *grid) 20 | { 21 | printf("Basic info:\n"); 22 | printf(" Resolution = %d %d\n", grid->XResolution(), grid->YResolution()); 23 | printf(" Spacing = %g\n", grid->GridToWorldScaleFactor()); 24 | printf(" Cardinality = %d\n", grid->Cardinality()); 25 | RNInterval grid_range = grid->Range(); 26 | printf(" Minimum = %g\n", grid_range.Min()); 27 | printf(" Maximum = %g\n", grid_range.Max()); 28 | printf(" L1Norm = %g\n", grid->L1Norm()); 29 | printf(" L2Norm = %g\n", grid->L2Norm()); 30 | fflush(stdout); 31 | 32 | // Return success 33 | return 1; 34 | } 35 | 36 | 37 | 38 | static int 39 | ParseArgs(int argc, char **argv) 40 | { 41 | // Parse arguments 42 | argc--; argv++; 43 | while (argc > 0) { 44 | if ((*argv)[0] == '-') { 45 | if (!strcmp(*argv, "-v")) print_verbose = 1; 46 | else { fprintf(stderr, "Invalid program argument: %s", *argv); exit(1); } 47 | } 48 | else { 49 | if (!input_name) input_name = *argv; 50 | else { fprintf(stderr, "Invalid program argument: %s", *argv); exit(1); } 51 | } 52 | argv++; argc--; 53 | } 54 | 55 | // Check input filename 56 | if (!input_name) { 57 | fprintf(stderr, "Usage: pfminfo inputfile [options]\n"); 58 | return 0; 59 | } 60 | 61 | // Return OK status 62 | return 1; 63 | } 64 | 65 | 66 | 67 | int 68 | main(int argc, char **argv) 69 | { 70 | // Parse program arguments 71 | if (!ParseArgs(argc, argv)) exit(-1); 72 | 73 | // Read grid 74 | R2Grid *grid = new R2Grid(); 75 | if (!grid->Read(input_name)) exit(-1); 76 | 77 | // Print info 78 | if (!PrintBasicInfo(grid)) exit(-1); 79 | 80 | // Return success 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /gaps/apps/pfmview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=pfmview 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/prp2prp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=prp2prp 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/prpview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=prpview 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | # 16 | # R3 application makefile 17 | # 18 | 19 | include ../../makefiles/Makefile.apps 20 | 21 | 22 | -------------------------------------------------------------------------------- /gaps/apps/ptsview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=ptsview 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/scn2cam/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scn2cam 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/scn2grd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scn2grd 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/scn2img/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scn2img 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/scn2scn/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scn2scn 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | 17 | # 18 | # R3 application makefile 19 | # 20 | 21 | include ../../makefiles/Makefile.apps 22 | 23 | 24 | -------------------------------------------------------------------------------- /gaps/apps/scninfo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scninfo 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/scnview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=scnview 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | # 10 | # Dependency libraries 11 | # 12 | 13 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 14 | 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sfl2img/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sfl2img 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sfl2sfl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sfl2sfl 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sflinfo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sflinfo 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sflinit/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sflinit 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sflprocess/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sflprocess 6 | CCSRCS=$(NAME).cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sflview/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Application name and list of source files. 3 | # 4 | 5 | NAME=sflview 6 | CCSRCS=$(NAME).cpp R3SurfelViewer.cpp debug.cpp align.cpp map.cpp 7 | 8 | 9 | 10 | # 11 | # Dependency libraries 12 | # 13 | 14 | PKG_LIBS=-lR3Surfels -lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -ljpeg -lpng 15 | 16 | # 17 | # R3 application makefile 18 | # 19 | 20 | include ../../makefiles/Makefile.apps 21 | 22 | 23 | -------------------------------------------------------------------------------- /gaps/apps/sflview/align.h: -------------------------------------------------------------------------------- 1 | // Include file for debug functions 2 | 3 | int DrawAlign(R3SurfelViewer *viewer); 4 | int ExtractObjectWithMesh(R3SurfelViewer *viewer); 5 | -------------------------------------------------------------------------------- /gaps/apps/sflview/debug.h: -------------------------------------------------------------------------------- 1 | // Include file for debug functions 2 | 3 | int DebugRedraw(R3SurfelViewer *viewer); 4 | int DebugResize(R3SurfelViewer *viewer, int w, int h); 5 | int DebugMouseMotion(R3SurfelViewer *viewer, int x, int y); 6 | int DebugMouseButton(R3SurfelViewer *viewer, int x, int y, int button, int state, int shift, int ctrl, int alt); 7 | int DebugKeyboard(R3SurfelViewer *viewer, int x, int y, int key, int shift, int ctrl, int alt); 8 | 9 | -------------------------------------------------------------------------------- /gaps/apps/sflview/map.h: -------------------------------------------------------------------------------- 1 | // Include file for map functions 2 | 3 | void DrawMap(R3SurfelViewer *viewer); 4 | -------------------------------------------------------------------------------- /gaps/docs/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS docs 3 | # 4 | 5 | opt: 6 | ./makeall 7 | 8 | debug: 9 | ./makeall 10 | 11 | release: 12 | mkdir -p ../release/docs 13 | cp Makefile ../release/docs 14 | cp makeall ../release/docs 15 | cp makepkg ../release/docs 16 | cp makepkg.awk ../release/docs 17 | cp -r headers ../release/docs 18 | cp ./*.html ../release/docs 19 | 20 | clean: 21 | - rm -f *~ *.html 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gaps/docs/headers/R3Graphics.header: -------------------------------------------------------------------------------- 1 |

Description:

2 | 3 | The R3Graphics package supports classes for basic computer graphics: 4 | 3D viewing, camera control, surface material properties, lighting, and scene graphs. 5 |

6 | 7 | 8 |


List of Classes:

9 | 10 |
11 |
Camera and viewport control: 12 |
13 |
R2Viewport - 2D screen viewport. 14 |
R3Camera - 3D camera (view frustum). 15 |
R3Viewer - Mapping from 3D camera to 2D viewport. 16 |
  17 |
18 | 19 |
Surface material properties: 20 |
21 |
R3Brdf - 3D bidirection reflectance distribution function. 22 |
R2Texture - 2D surface texture. 23 |
R3Material - 3D material properties (brdf, texture, and texture transformation). 24 |
R3Model - a set of 3D triangles with material properties. 25 |
  26 |
27 | 28 |
Lights: 29 |
30 |
R3Light - Light abstract class. 31 |
R3DirectionalLight - Directional light. 32 |
R3PointLight - Point light. 33 |
R3SpotLight - Spot light. 34 |
  35 |
36 | 37 |
Scene graphs: 38 |
39 |
R3Scene - scene graph. 40 |
R3SceneNode - scene graph node. 41 |
  42 |
43 |
44 |

45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /gaps/docs/headers/RNBasics.header: -------------------------------------------------------------------------------- 1 |


Description:

2 | 3 | The RNBasics package supports simple data types (RNScalar, RNInterval, 4 | RNArray, RNQueue, RNHeap) and support several OS-dependent functions 5 | (RNTime, RNMem, RNError). 6 | 7 | The RNArray, RNQueue, and RNHeap classes are implemented as templates 8 | that store collections of a specified data type (like STL classes). 9 | The storage allocation for these containers is dynamic -- it expands 10 | and contracts as entries are inserted and removed. Once a container 11 | has been constructed, entries and the data stored in them can be 12 | accessed, rearranged, or modified via member functions or iteration 13 | macros. For example, an array of three strings could be constructed 14 | and manipulated as follows: 15 | 16 |
17 |     // Construct the array
18 |     RNArray<char *> array;   // Creates an empty array
19 |     array.Insert("String1");       // Insert the 1st string
20 |     array.Insert("String2");       // Insert the 2nd string
21 |     array.Insert("String3");       // Insert the 3rd string
22 | 
23 |     // Access entries
24 |     char *data;
25 |     data = array.Head();           // data == "String1"
26 |     data = array.Tail();           // data == "String3"
27 |     data = array.Kth(0);           // data == "String1"
28 |     data = array.Kth(1);           // data == "String2"
29 |     data = array[1];               // data == "String2"
30 | 
31 |     // Access all entries
32 |     for (int i = 0; i < array.NEntries(); i++) {
33 |       char *data = array[i]
34 |       printf("%s/n", data);       
35 |     }
36 | 
37 |     // Manipulate the array
38 |     array.Reverse();               // Reverse the order of entries
39 |     array.RemoveKth(1);            // Remove the 2nd entry (first entry is at index 0)
40 |     array.InsertKth("String2", 1); // Re-insert string in 2nd entry
41 | 
42 |

43 | 44 | Other support functions include: 45 | 46 |

53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /gaps/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | GAPS Documentation 3 | 4 | 5 | 6 |

GAPS

7 | 8 |

GAPS is a software toolkit for geometric analysis of 3D scenes.

9 | 10 |

It contains the following four packages ...

11 | 17 | 18 |

.. and several example applications:

19 | 31 | 32 |

Please view the README file for more information about compiling and linking.

33 | 34 |
35 |
funk@cs.princeton.edu
36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/docs/makeall: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | for pkg in RNBasics R2Shapes R3Shapes R3Graphics; do 4 | echo $pkg 5 | ./makepkg $pkg 6 | done 7 | 8 | -------------------------------------------------------------------------------- /gaps/docs/makepkg: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # usage : makepkg name 3 | 4 | # Create header 5 | echo "" > $1.html 6 | echo "" >> $1.html 7 | echo " $1 Package " >> $1.html 8 | echo "" >> $1.html 9 | echo "" >> $1.html 10 | echo "

$1 Package

" >> $1.html 11 | echo >> $1.html 12 | echo >> $1.html 13 | echo >> $1.html 14 | 15 | # Create description 16 | if [ -e headers/$1.header ]; then 17 | # Read description, list of classes, and examples from header 18 | cat headers/$1.header >> $1.html 19 | fi 20 | 21 | # Create class members 22 | awk -f makepkg.awk ../pkgs/$1/*.h >> $1.html 23 | sed -e "s/RNFoobar/$1/g" < $1.html > $1.html.new 24 | mv $1.html.new $1.html 25 | echo >> $1.html 26 | echo >> $1.html 27 | echo >> $1.html 28 | 29 | # Create trailer 30 | echo "
" >> $1.html 31 | echo 'Click this to go back to list of GAPS packages.' >> $1.html 32 | echo "

" >> $1.html 33 | echo "" >> $1.html 34 | echo "

funk@cs.princeton.edu
" >> $1.html 35 | echo >> $1.html 36 | echo "" >> $1.html 37 | echo >> $1.html 38 | echo >> $1.html 39 | echo >> $1.html 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/docs/makepkg.awk: -------------------------------------------------------------------------------- 1 | # Make html file with class documentation 2 | # NOTE: Does not insert inherited members 3 | 4 | $0~"class " && $0~"{" { 5 | # Parse package name and class name 6 | pkg_name = "RNFoobar"; 7 | class_name = $2; 8 | 9 | # Print class name 10 | printf "

%s

\n\n", 11 | class_name, pkg_name, class_name, class_name; 12 | 13 | # Print base classes 14 | printf "
\n"; 15 | printf "

Base Classes:

\n"; 16 | printf "
\n"; 17 | printf "

Public Base Classes:

\n"; 18 | printf "
\n"; 19 | found = 0; 20 | split($0, s0); 21 | for (i = 3; i <= NF; i++) { 22 | if (s0[i] == "public") { 23 | printf "
%s\n", $(i+1), $(i+1) 24 | found = 1; 25 | } 26 | } 27 | if (!found) printf "
\tNone\n"; 28 | printf "
\n"; 29 | printf "

\n"; 30 | 31 | # Print member functions 32 | printf "

Member Functions:

\n"; 33 | printf "
\n"; 34 | active = 0; 35 | first = 1; 36 | } 37 | 38 | $0~"};" { 39 | if (!first) printf "
\n"; 40 | printf "
\n"; 41 | printf "\n\n\n\n"; 42 | printf "

\n"; 43 | active = 0; 44 | } 45 | 46 | { 47 | sub("\r$", ""); 48 | if ($1 == "public:") { 49 | active = 1; 50 | } 51 | else if (($1 == "protected:") || ($1 == "private:")) { 52 | active = 0; 53 | } 54 | else if (active) { 55 | if ($1 == "//") { 56 | split($0, s0) 57 | if (!first) printf "\n"; 58 | printf "

"; 59 | for (i = 2; i <= NF; i++) printf " %s", s0[i]; 60 | printf ":

\n"; 61 | printf "
\n"; 62 | first = 0; 63 | } 64 | else { 65 | print "
" $0; 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /gaps/makefiles/Makefile.apps: -------------------------------------------------------------------------------- 1 | 2 | # Makefile for GAPS applications 3 | # 4 | 5 | 6 | 7 | # 8 | # Before this Makefile is included ... 9 | # $(NAME) should be module name 10 | # $(CCSRCS) should list C++ source files 11 | # $(CSRCS) should list C source files 12 | # 13 | # For example ... 14 | # NAME=foo 15 | # CCSRCS=$(NAME).cpp \ 16 | # foo1.cpp foo2.cpp foo3.cpp 17 | # CSRCS=foo4.c foo5.c 18 | # 19 | 20 | 21 | # 22 | # Set up compiler options, etc. 23 | # 24 | 25 | include ../../makefiles/Makefile.std 26 | 27 | 28 | 29 | 30 | # 31 | # Set up target app 32 | # 33 | 34 | EXE = $(EXE_DIR)/$(NAME) 35 | 36 | 37 | 38 | # 39 | # Set up link options 40 | # 41 | 42 | BASE_LDFLAGS=$(USER_LDFLAGS) -L$(LIB_DIR) 43 | DEBUG_LDFLAGS=$(BASE_LDFLAGS) -g 44 | OPT_LDFLAGS=$(BASE_LDFLAGS) -O 45 | LDFLAGS=$(DEBUG_LDFLAGS) 46 | 47 | 48 | # 49 | # Set up libs 50 | # 51 | 52 | ifeq ("$(findstring CYGWIN,$(OS))", "CYGWIN") 53 | #OPENGL_LIBS=-lglut32 -lglu32 -lopengl32 54 | OPENGL_LIBS=-lfglut -lglu32 -lopengl32 -lwinmm -lgdi32 55 | else ifeq ("$(OS)","Darwin") 56 | OPENGL_LIBS=-framework GLUT -framework opengl 57 | else 58 | #OPENGL_LIBS=-lglut -lGLU -lGL -lX11 -lm 59 | OPENGL_LIBS=-lfglut -lGLU -lGL -lX11 -lm 60 | endif 61 | LIBS=$(PKG_LIBS) $(USER_LIBS) $(OPENGL_LIBS) 62 | 63 | 64 | 65 | # 66 | # Make targets 67 | # 68 | 69 | opt: 70 | $(MAKE) $(EXE) "CFLAGS=$(OPT_CFLAGS)" "LDFLAGS=$(OPT_LDFLAGS)" 71 | 72 | debug: 73 | $(MAKE) $(EXE) "CFLAGS=$(DEBUG_CFLAGS)" "LDFLAGS=$(DEBUG_LDFLAGS)" 74 | 75 | mesa: 76 | $(MAKE) $(EXE) "CFLAGS=$(OPT_CFLAGS) -DUSE_MESA" "LDFLAGS=$(OPT_LDFLAGS) -lOSMesa" 77 | 78 | $(EXE): $(OBJS) $(LIB_DIR)/*.a 79 | mkdir -p $(EXE_DIR) 80 | $(CC) -o $(EXE) $(LDFLAGS) $(USER_OBJS) $(OBJS) $(LIBS) 81 | 82 | release: 83 | mkdir -p $(RELEASE_DIR)/apps 84 | mkdir $(RELEASE_DIR)/apps/$(NAME)1 85 | cp *\.[!o]* $(RELEASE_DIR)/apps/$(NAME)1 86 | cp Makefile $(RELEASE_DIR)/apps/$(NAME)1 87 | cp $(NAME).vcxproj $(RELEASE_DIR)/apps/$(NAME)1 88 | rm -r -f $(RELEASE_DIR)/apps/$(NAME) 89 | mv $(RELEASE_DIR)/apps/$(NAME)1 $(RELEASE_DIR)/apps/$(NAME) 90 | 91 | clean: 92 | - rm -f *~ *.o $(EXE) 93 | 94 | 95 | 96 | # 97 | # Dependencies 98 | # 99 | 100 | PKG_LIBS += $(foreach pkg, $(PKG_DEPENDENCIES), -l$(pkg)) 101 | PKG_LIST=$(subst -l,,$(PKG_LIBS)) 102 | $(OBJS) : Makefile $(wildcard *.h) $(foreach pkg, $(PKG_LIST), ../../pkgs/$(pkg)/*.h) $(USER_DEPENDENCIES) 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /gaps/makefiles/Makefile.pkgs: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS packages 3 | # 4 | 5 | 6 | 7 | # 8 | # Before this Makefile is included ... 9 | # $(NAME) should be module name 10 | # $(CCSRCS) should list C++ source files 11 | # $(CSRCS) should list C source files 12 | # 13 | # For example ... 14 | # NAME=foo 15 | # CCSRCS=$(NAME).cpp \ 16 | # foo1.cpp foo2.cpp foo3.cpp 17 | # CSRCS=foo4.c foo5.c 18 | # 19 | 20 | 21 | # 22 | # Set up compiler options, etc. 23 | # 24 | 25 | include ../../makefiles/Makefile.std 26 | 27 | 28 | 29 | # 30 | # Set up target name 31 | # 32 | 33 | LIB=$(LIB_DIR)/lib$(NAME).a 34 | 35 | 36 | 37 | # 38 | # Make targets 39 | # 40 | 41 | opt: 42 | $(MAKE) $(LIB) "CFLAGS=$(OPT_CFLAGS)" 43 | 44 | debug: 45 | $(MAKE) $(LIB) "CFLAGS=$(DEBUG_CFLAGS)" 46 | 47 | $(LIB): $(CCSRCS) $(CSRCS) $(OSRCS) $(OBJS) $(DEPENDENCIES) 48 | mkdir -p $(LIB_DIR) 49 | rm -f $(LIB) 50 | ar ur $(LIB) $(OBJS) $(USER_OBJS) 51 | 52 | release: 53 | mkdir -p $(RELEASE_DIR)/pkgs 54 | mkdir $(RELEASE_DIR)/pkgs/$(NAME)1 55 | cp *\.[!o]* $(RELEASE_DIR)/pkgs/$(NAME)1 56 | cp Makefile $(RELEASE_DIR)/pkgs/$(NAME)1 57 | cp $(NAME).vcxproj $(RELEASE_DIR)/pkgs/$(NAME)1 58 | rm -r -f $(RELEASE_DIR)/pkgs/$(NAME) 59 | mv $(RELEASE_DIR)/pkgs/$(NAME)1 $(RELEASE_DIR)/pkgs/$(NAME) 60 | 61 | clean: 62 | - rm -f *~ *.o $(LIB) 63 | 64 | 65 | 66 | # 67 | # Dependencies 68 | # 69 | 70 | $(OBJS) : Makefile *.h $(foreach pkg, $(PKG_DEPENDENCIES), ../$(pkg)/*.h) $(USER_DEPENDENCIES) 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /gaps/makefiles/Makefile.std: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile setup for GAPS 3 | # 4 | 5 | 6 | 7 | # 8 | # Targets 9 | # 10 | 11 | OBJS=$(CCSRCS:.cpp=.o) $(CSRCS:.c=.o) 12 | INCS=$(HSRCS) $(CCSRCS:.cpp=.h) $(CSRCS:.c=.h) 13 | 14 | 15 | 16 | # 17 | # Get the operating system and architecture type 18 | # 19 | 20 | OS=$(shell uname -s) 21 | ARCH=$(shell uname -m) 22 | 23 | 24 | 25 | # 26 | # C flags 27 | # 28 | 29 | #ifeq ("$(findstring CYGWIN,$(OS))", "CYGWIN") 30 | #OS_CFLAGS=-Wl,-stack_size,0x100000000 31 | #endif 32 | 33 | CC=g++ 34 | BASE_CFLAGS=$(USER_CFLAGS) $(OS_CFLAGS) -Wall -I. -I../../pkgs 35 | DEBUG_CFLAGS=$(BASE_CFLAGS) -g 36 | OPT_CFLAGS=$(BASE_CFLAGS) -O3 -DNDEBUG 37 | CFLAGS=$(DEBUG_CFLAGS) 38 | 39 | #ifeq ("$(OS)","Darwin") 40 | # BASE_CFLAGS=$(USER_CFLAGS) $(OS_CFLAGS) -Wall -I. -I../../pkgs -Wno-deprecated-declarations 41 | #endif 42 | 43 | 44 | 45 | # 46 | # Directories 47 | # 48 | 49 | RELEASE_DIR=../../release 50 | EXE_DIR=../../bin/$(ARCH) 51 | LIB_DIR=../../lib/$(ARCH) 52 | 53 | 54 | 55 | # 56 | # Default rules 57 | # 58 | 59 | .SUFFIXES: .cpp .C .c .o 60 | 61 | .cpp.o: 62 | $(CC) $(CFLAGS) -c $< 63 | 64 | .C.o: 65 | $(CC) $(CFLAGS) -c $< 66 | 67 | .c.o: 68 | gcc $(CFLAGS) -c $< 69 | 70 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/FET.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for FET module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "FET.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int FET_active_count = 0; 14 | 15 | 16 | 17 | int R3InitFET(void) 18 | { 19 | // Check whether are already initialized 20 | if ((FET_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void R3StopFET(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--FET_active_count) > 0) return; 35 | 36 | // Stop dependencies 37 | R3StopShapes(); 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/FET.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////// 2 | // Package include files 3 | //////////////////////////////////////////////////////////////////////// 4 | 5 | #include "RNMath/RNMath.h" 6 | #include "R3Shapes/R3Shapes.h" 7 | 8 | 9 | 10 | //////////////////////////////////////////////////////////////////////// 11 | // icpview class declarations 12 | //////////////////////////////////////////////////////////////////////// 13 | 14 | struct FETDescriptor; 15 | struct FETFeature; 16 | struct FETCorrespondence; 17 | struct FETShape; 18 | struct FETMatch; 19 | struct FETReconstruction; 20 | 21 | 22 | 23 | //////////////////////////////////////////////////////////////////////// 24 | // icpview include files 25 | //////////////////////////////////////////////////////////////////////// 26 | 27 | #include "FETDescriptor.h" 28 | #include "FETFeature.h" 29 | #include "FETCorrespondence.h" 30 | #include "FETShape.h" 31 | #include "FETMatch.h" 32 | #include "FETReconstruction.h" 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/FETDescriptor.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////// 2 | // Class definition 3 | //////////////////////////////////////////////////////////////////////// 4 | 5 | struct FETDescriptor { 6 | public: 7 | // Constructors 8 | FETDescriptor(int nvalues = 0, float *values = NULL); 9 | FETDescriptor(const FETDescriptor& descriptor); 10 | ~FETDescriptor(void); 11 | 12 | // Properties 13 | int NValues(void) const; 14 | float Value(int k) const; 15 | float L1Norm(void) const; 16 | 17 | // Manipulation 18 | FETDescriptor& operator=(const FETDescriptor& descriptor); 19 | void Reset(int nvalues = 0, float *values = NULL); 20 | void SetValue(int k, float value); 21 | 22 | // Input/output 23 | int ReadAscii(FILE *fp); 24 | int ReadBinary(FILE *fp); 25 | int WriteAscii(FILE *fp) const; 26 | int WriteBinary(FILE *fp) const; 27 | 28 | // Relationships 29 | float SquaredDistance(const FETDescriptor& descriptor, float unknown_penalty = 10) const; 30 | float Distance(const FETDescriptor& descriptor, float unknown_penalty = 10) const; 31 | 32 | public: 33 | // Internal data 34 | float *values; 35 | int nvalues; 36 | }; 37 | -------------------------------------------------------------------------------- /gaps/pkgs/FET/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=FET 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | FETReconstruction.cpp \ 15 | FETMatch.cpp \ 16 | FETShape.cpp \ 17 | FETCorrespondence.cpp \ 18 | FETFeature.cpp \ 19 | FETDescriptor.cpp 20 | 21 | 22 | 23 | # 24 | # Include flags for optimization 25 | # 26 | 27 | #USER_CFLAGS=-I/usr/local/suitesparse -I/usr/local/include/eigen3 -DRN_USE_CERES -DRN_USE_MINPACK -DRN_USE_SPLM -DRN_USE_CSPARSE 28 | #USER_CFLAGS=-I/usr/include/suitesparse -I/usr/include/eigen3 -DRN_USE_CERES -DRN_USE_MINPACK -DRN_USE_SPLM -DRN_USE_CSPARSE 29 | #USER_CFLAGS=-DRN_USE_CSPARSE -DRN_USE_SPLM 30 | 31 | 32 | 33 | # 34 | # Dependencies 35 | # 36 | 37 | PKG_DEPENDENCIES=R3Shapes R2Shapes RNMath RNBasics 38 | 39 | 40 | 41 | # 42 | # PKG makefile 43 | # 44 | 45 | include ../../makefiles/Makefile.pkgs 46 | 47 | 48 | -------------------------------------------------------------------------------- /gaps/pkgs/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS pkgs 3 | # 4 | 5 | 6 | # 7 | # Library file names 8 | # 9 | 10 | ARCH=$(shell uname -m) 11 | LIB_DIR=../lib/$(ARCH) 12 | LIB=$(LIB_DIR)/libgaps.a 13 | PKG_LIBS= \ 14 | $(LIB_DIR)/libFET.a \ 15 | $(LIB_DIR)/libR3Surfels.a \ 16 | $(LIB_DIR)/libR3Graphics.a \ 17 | $(LIB_DIR)/libR3Shapes.a \ 18 | $(LIB_DIR)/libR2Shapes.a \ 19 | $(LIB_DIR)/libRNMath.a \ 20 | $(LIB_DIR)/libRNBasics.a \ 21 | $(LIB_DIR)/libjpeg.a \ 22 | $(LIB_DIR)/libpng.a 23 | 24 | 25 | # 26 | # Make targets 27 | # 28 | 29 | opt: 30 | $(MAKE) target "TARGET=$@" 31 | rm -f $(LIB) 32 | ar ur $(LIB) $(PKG_LIBS) 33 | 34 | debug: 35 | $(MAKE) target "TARGET=$@" 36 | rm -f $(LIB) 37 | ar ur $(LIB) $(PKG_LIBS) 38 | 39 | mesa: 40 | $(MAKE) opt 41 | 42 | clean: 43 | $(MAKE) target "TARGET=$@" 44 | 45 | release: 46 | mkdir -p ../release/pkgs 47 | cp Makefile ../release/pkgs 48 | $(MAKE) target "TARGET=$@" 49 | 50 | target: 51 | cd RNBasics; $(MAKE) $(TARGET) 52 | cd RNMath; $(MAKE) $(TARGET) 53 | cd R2Shapes; $(MAKE) $(TARGET) 54 | cd R3Shapes; $(MAKE) $(TARGET) 55 | cd R3Graphics; $(MAKE) $(TARGET) 56 | cd R3Surfels; $(MAKE) $(TARGET) 57 | cd FET; $(MAKE) $(TARGET) 58 | cd fglut; $(MAKE) $(TARGET) 59 | cd jpeg; $(MAKE) $(TARGET) 60 | cd png; $(MAKE) $(TARGET) 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=PDB 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | PDBElement.cpp PDBAminoAcid.cpp \ 15 | PDBAtom.cpp PDBResidue.cpp PDBChain.cpp PDBModel.cpp PDBFile.cpp \ 16 | PDBBond.cpp PDBAtomTypes.cpp PDBUtil.cpp PDBDistance.cpp 17 | 18 | 19 | 20 | # 21 | # Dependencies 22 | # 23 | 24 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics 25 | 26 | 27 | 28 | # 29 | # PKG makefile 30 | # 31 | 32 | include ../../makefiles/Makefile.pkgs 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDB.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for PDB package */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "PDB.h" 8 | 9 | 10 | 11 | // Global variables 12 | 13 | RNMark PDBmark = 1; 14 | 15 | 16 | 17 | /* Private variables */ 18 | 19 | static int PDBactive_count = 0; 20 | 21 | 22 | 23 | int PDBInit(void) 24 | { 25 | // Check whether are already initialized 26 | if ((PDBactive_count++) > 0) return TRUE; 27 | 28 | // Initialize submodules 29 | // ??? 30 | 31 | // Return OK status 32 | return TRUE; 33 | } 34 | 35 | 36 | 37 | void PDBStop(void) 38 | { 39 | // Check whether have been initialized 40 | if ((--PDBactive_count) > 0) return; 41 | 42 | // Stop submodules 43 | // ??? 44 | } 45 | 46 | 47 | 48 | void PDBClearMarks(void) 49 | { 50 | // Create new mark 51 | PDBmark++; 52 | } 53 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDB.h: -------------------------------------------------------------------------------- 1 | // Header file for PDB package 2 | 3 | #ifndef __PDB__H__ 4 | #define __PDB__H__ 5 | 6 | 7 | 8 | // Dependency include files 9 | 10 | #include "R3Shapes/R3Shapes.h" 11 | 12 | 13 | 14 | // PDB structure class pre-declarations 15 | 16 | class PDBElement; 17 | class PDBAminoAcid; 18 | class PDBAtom; 19 | class PDBResidue; 20 | class PDBChain; 21 | class PDBModel; 22 | class PDBFile; 23 | class PDBBond; 24 | 25 | 26 | 27 | // PDB structure types 28 | 29 | typedef enum { 30 | PDB_FILE, 31 | PDB_MODEL, 32 | PDB_CHAIN, 33 | PDB_RESIDUE, 34 | PDB_ATOM 35 | } PDBStructureType; 36 | 37 | 38 | 39 | // Global variables 40 | 41 | extern RNMark PDBmark; 42 | 43 | 44 | 45 | // Useful constants 46 | 47 | #define PDB_UNKNOWN (123456789E-10) 48 | 49 | 50 | 51 | // PDB structure include files 52 | 53 | #include "PDBUtil.h" 54 | #include "PDBAtomTypes.h" 55 | #include "PDBElement.h" 56 | #include "PDBAminoAcid.h" 57 | #include "PDBAtom.h" 58 | #include "PDBResidue.h" 59 | #include "PDBChain.h" 60 | #include "PDBModel.h" 61 | #include "PDBFile.h" 62 | #include "PDBBond.h" 63 | #include "PDBDistance.h" 64 | 65 | 66 | 67 | // Initialization functions 68 | 69 | int PDBInit(void); 70 | void PDBStop(void); 71 | 72 | 73 | 74 | // Other functions 75 | 76 | void PDBClearMarks(void); 77 | 78 | 79 | 80 | #endif 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDBDistance.h: -------------------------------------------------------------------------------- 1 | // Include file for PDB distance utility 2 | 3 | 4 | 5 | // Distance functions 6 | 7 | RNLength PDBDistance(PDBAtom *atom1, PDBAtom *atom2); 8 | RNLength PDBDistance(PDBAtom *atom, PDBResidue *residue); 9 | RNLength PDBDistance(PDBAtom *atom, PDBChain *chain); 10 | 11 | RNLength PDBDistance(PDBResidue *residue, PDBAtom *atom); 12 | RNLength PDBDistance(PDBResidue *residue1, PDBResidue *residue2); 13 | RNLength PDBDistance(PDBResidue *residue, PDBChain *chain); 14 | 15 | RNLength PDBDistance(PDBChain *chain, PDBAtom *atom); 16 | RNLength PDBDistance(PDBChain *chain, PDBResidue *residue); 17 | RNLength PDBDistance(PDBChain *chain1, PDBChain *chain2); 18 | 19 | 20 | 21 | // Inline functions 22 | 23 | inline RNLength 24 | PDBDistance(PDBResidue *residue, PDBAtom *atom) 25 | { 26 | // Distance is commutative 27 | return PDBDistance(atom, residue); 28 | } 29 | 30 | 31 | 32 | inline RNLength 33 | PDBDistance(PDBChain *chain, PDBAtom *atom) 34 | { 35 | // Distance is commutative 36 | return PDBDistance(atom, chain); 37 | } 38 | 39 | 40 | 41 | inline RNLength 42 | PDBDistance(PDBChain *chain, PDBResidue *residue) 43 | { 44 | // Distance is commutative 45 | return PDBDistance(residue, chain); 46 | } 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /gaps/pkgs/PDB/PDBPick.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjhartmann/SUNCGtoolbox/23a22a5f913ba3ab6989005a129278ed20dbd0f3/gaps/pkgs/PDB/PDBPick.cpp -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R2Shapes 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=R2Shapes.cpp \ 14 | R2Draw.cpp R2Io.cpp R2Kdtree.cpp \ 15 | R2Dist.cpp R2Cont.cpp R2Isect.cpp R2Parall.cpp R2Perp.cpp R2Relate.cpp R2Align.cpp \ 16 | R2Grid.cpp \ 17 | R2Polyline.cpp R2Arc.cpp R2Curve.cpp \ 18 | R2Polygon.cpp R2Circle.cpp R2Box.cpp R2Solid.cpp \ 19 | R2Shape.cpp \ 20 | R2Affine.cpp R2Xform.cpp R2Crdsys.cpp R2Diad.cpp R3Matrix.cpp \ 21 | R2Halfspace.cpp R2Span.cpp R2Ray.cpp R2Line.cpp R2Point.cpp R2Vector.cpp \ 22 | R2Image.cpp 23 | 24 | 25 | # 26 | # Dependencies 27 | # 28 | 29 | PKG_DEPENDENCIES = RNBasics jpeg png 30 | 31 | 32 | 33 | # 34 | # PKG makefile 35 | # 36 | 37 | include ../../makefiles/Makefile.pkgs 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Align.h: -------------------------------------------------------------------------------- 1 | // Include file for alignment utility functions 2 | 3 | 4 | 5 | // Functions to align RNArray of points 6 | 7 | R2Point R2Centroid(const RNArray& points, const RNScalar *weights = NULL); 8 | R2Diad R2PrincipleAxes(const R2Point& centroid, const RNArray& points, const RNScalar *weights = NULL, RNScalar *variances = NULL); 9 | RNLength R2AverageDistance(const R2Point& center, const RNArray& points, const RNScalar *weights = NULL); 10 | R2Affine R2NormalizationTransformation(const RNArray& points, 11 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 12 | RNScalar R2AlignError(const RNArray& points1, const RNArray& points2, 13 | const R3Matrix& matrix = R3identity_matrix, const RNScalar* weights = NULL); 14 | R3Matrix R2AlignPoints(const RNArray& points1, const RNArray& poitns2, const RNScalar* weights = NULL, 15 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 16 | 17 | 18 | 19 | // Functions to align C array of points 20 | 21 | R2Point R2Centroid(int npoints, R2Point *points, const RNScalar *weights = NULL); 22 | R2Diad R2PrincipleAxes(const R2Point& centroid, int npoints, R2Point *points, const RNScalar *weights = NULL, RNScalar *variances = NULL); 23 | RNLength R2AverageDistance(const R2Point& center, int npoints, R2Point *points, const RNScalar *weights = NULL); 24 | R2Affine R2NormalizationTransformation(int npoints, R2Point *points, 25 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 26 | RNScalar R2AlignError(int npoints, R2Point *points1, R2Point *points2, 27 | const R3Matrix& matrix = R3identity_matrix, RNScalar* weights = NULL); 28 | R3Matrix R2AlignPoints(int npoints, R2Point *points1, R2Point *points2, const RNScalar* weights = NULL, 29 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Circle.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 circle class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitCircle(); 8 | void R2StopCircle(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Circle : public R2Solid { 15 | public: 16 | // Constructor functions 17 | R2Circle(void); 18 | R2Circle(const R2Circle& circle); 19 | R2Circle(const R2Point& center, RNLength radius); 20 | 21 | // Circle property functions/operators 22 | const R2Point& Center(void) const; 23 | const RNLength Radius(void) const; 24 | const RNBoolean IsEmpty(void) const; 25 | const RNBoolean IsFinite(void) const; 26 | 27 | // Shape property functions/operators 28 | virtual const RNBoolean IsPoint(void) const; 29 | virtual const RNBoolean IsLinear(void) const ; 30 | virtual const RNBoolean IsConvex(void) const ; 31 | virtual const RNArea Area(void) const; 32 | virtual const R2Point Centroid(void) const; 33 | virtual const R2Shape& BShape(void) const; 34 | virtual const R2Box BBox(void) const; 35 | virtual const R2Circle BCircle(void) const; 36 | 37 | // Manipulation functions/operators 38 | virtual void Empty(void); 39 | virtual void Translate(const R2Vector& vector); 40 | virtual void Reposition(const R2Point& center); 41 | virtual void Resize(RNLength radius); 42 | virtual void Transform(const R2Transformation& transformation); 43 | 44 | // Draw functions/operators 45 | virtual void Draw(const R2DrawFlags draw_flags = R2_DEFAULT_DRAW_FLAGS) const; 46 | 47 | private: 48 | R2Point center; 49 | RNLength radius; 50 | }; 51 | 52 | 53 | 54 | /* Public variables */ 55 | 56 | extern const R2Circle R2null_circle; 57 | extern const R2Circle R2zero_circle; 58 | extern const R2Circle R2unit_circle; 59 | extern const R2Circle R2infinite_circle; 60 | 61 | extern const int R2circle_npoints; 62 | extern RNAngle R2circle_angles[]; 63 | extern R2Point R2circle_points[]; 64 | 65 | 66 | 67 | /* Inline functions */ 68 | 69 | inline const R2Point& R2Circle:: 70 | Center(void) const 71 | { 72 | // Return circle center 73 | return center; 74 | } 75 | 76 | 77 | 78 | inline const RNLength R2Circle:: 79 | Radius(void) const 80 | { 81 | // Return circle radius 82 | return radius; 83 | } 84 | 85 | 86 | 87 | inline const RNBoolean R2Circle:: 88 | IsEmpty(void) const 89 | { 90 | // Return whether the circle is null 91 | return (radius < 0.0); 92 | } 93 | 94 | 95 | 96 | inline const RNBoolean R2Circle:: 97 | IsFinite(void) const 98 | { 99 | // Return whether the circle has finite radius 100 | return RNIsFinite(radius); 101 | } 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Crdsys.h: -------------------------------------------------------------------------------- 1 | /* Include file for the GAPS coordinate system class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitCoordinateSystem(); 8 | void R2StopCoordinateSystem(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2CoordSystem /* : public R2Base */ { 15 | public: 16 | // Constructor functions 17 | R2CoordSystem(void); 18 | R2CoordSystem(const R2CoordSystem& cs); 19 | R2CoordSystem(const R2Point& origin, const R2Diad& axes); 20 | 21 | // Property functions/operators 22 | const R2Point& Origin(void) const; 23 | const R2Diad& Axes(void) const; 24 | const R3Matrix Matrix(void) const; 25 | const R3Matrix InverseMatrix(void) const; 26 | const RNBoolean operator==(const R2CoordSystem& cs) const; 27 | const RNBoolean operator!=(const R2CoordSystem& cs) const; 28 | 29 | // Manipulation functions/operators 30 | void Translate(const R2Vector& offset); 31 | void Rotate(RNAngle radians); 32 | void Mirror(const R2Line& line); 33 | void Transform(const R2Transformation& transformation); 34 | void InverseTransform(const R2Transformation& transformation); 35 | void SetOrigin(const R2Point& origin); 36 | void SetAxes(const R2Diad& axes); 37 | 38 | // Draw functions/operators 39 | void Draw(void) const; 40 | void Outline(void) const; 41 | 42 | private: 43 | R2Point origin; 44 | R2Diad axes; 45 | }; 46 | 47 | 48 | 49 | /* Public variables */ 50 | 51 | extern const R2CoordSystem R2xy_coordinate_system; 52 | 53 | 54 | 55 | /* Inline functions */ 56 | 57 | inline const R2Point& R2CoordSystem:: 58 | Origin(void) const 59 | { 60 | // Return origin 61 | return origin; 62 | } 63 | 64 | 65 | 66 | inline const R2Diad& R2CoordSystem:: 67 | Axes(void) const 68 | { 69 | // Return axes diad 70 | return axes; 71 | } 72 | 73 | 74 | 75 | inline const RNBoolean R2CoordSystem:: 76 | operator==(const R2CoordSystem& cs) const 77 | { 78 | // Return whether coordinate system is equal 79 | return (origin == cs.origin) && (axes == cs.axes); 80 | } 81 | 82 | 83 | 84 | inline const RNBoolean R2CoordSystem:: 85 | operator!=(const R2CoordSystem& cs) const 86 | { 87 | // Return whether coordinate system is not equal 88 | return !(*this == cs); 89 | } 90 | 91 | 92 | 93 | inline void R2CoordSystem:: 94 | Outline(void) const 95 | { 96 | // Draw coordinate system 97 | Draw(); 98 | } 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Curve.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 curve class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R2InitCurve() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R2StopCurve() 24 | { 25 | } 26 | 27 | 28 | 29 | R2Curve:: 30 | R2Curve(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R2Curve:: 37 | ~R2Curve(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R2Curve:: 44 | IsCurve(void) const 45 | { 46 | // All curve shapes are curves 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Curve.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 curve class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitCurve(); 8 | void R2StopCurve(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Curve : public R2Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R2Curve(void); 18 | ~R2Curve(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsCurve(void) const; 22 | 23 | // Curve property functions/operators 24 | // virtual const R2Point Start(void) const = 0; 25 | // virtual const R2Point End(void) const = 0; 26 | }; 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Diad.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS diad class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public variables */ 12 | 13 | const R2Diad R2xy_diad(R2Vector(1.0, 0.0), R2Vector(0.0, 1.0)); 14 | 15 | 16 | 17 | /* Public functions */ 18 | 19 | int R2InitDiad() 20 | { 21 | /* Return success */ 22 | return TRUE; 23 | } 24 | 25 | 26 | 27 | void R2StopDiad() 28 | { 29 | } 30 | 31 | 32 | 33 | R2Diad:: 34 | R2Diad(void) 35 | { 36 | } 37 | 38 | 39 | 40 | R2Diad:: 41 | R2Diad(const R2Diad& diad) 42 | { 43 | axis[0] = diad.axis[0]; 44 | axis[1] = diad.axis[1]; 45 | } 46 | 47 | 48 | 49 | R2Diad:: 50 | R2Diad(const R2Vector& xaxis, const R2Vector& yaxis) 51 | { 52 | // Just checking ... 53 | assert(xaxis.IsNormalized()); 54 | assert(yaxis.IsNormalized()); 55 | assert(R2Perpendicular(xaxis, yaxis)); 56 | 57 | // Assign axes 58 | axis[0] = xaxis; 59 | axis[1] = yaxis; 60 | } 61 | 62 | 63 | 64 | const R3Matrix R2Diad:: 65 | Matrix(void) const 66 | { 67 | // Return change of basis matrix (std -> diad) 68 | return R3Matrix(axis[0].X(), axis[1].X(), 0.0, 69 | axis[0].Y(), axis[1].Y(), 0.0, 70 | 0.0, 0.0, 1.0); 71 | } 72 | 73 | 74 | 75 | const R3Matrix R2Diad:: 76 | InverseMatrix(void) const 77 | { 78 | // Return change of basis matrix (diad -> std) 79 | return R3Matrix(axis[0].X(), axis[0].Y(), 0.0, 80 | axis[1].X(), axis[1].Y(), 0.0, 81 | 0.0, 0.0, 1.0); 82 | } 83 | 84 | 85 | 86 | void R2Diad:: 87 | Normalize(void) 88 | { 89 | // Normalize each axis 90 | axis[0].Normalize(); 91 | axis[1].Normalize(); 92 | } 93 | 94 | 95 | 96 | void R2Diad:: 97 | Rotate(RNAngle radians) 98 | { 99 | // Mirror each axis 100 | axis[0].Rotate(radians); 101 | axis[1].Rotate(radians); 102 | } 103 | 104 | 105 | 106 | void R2Diad:: 107 | Mirror(const R2Line& line) 108 | { 109 | // Mirror each axis 110 | axis[0].Mirror(line); 111 | axis[1].Mirror(line); 112 | } 113 | 114 | 115 | 116 | void R2Diad:: 117 | Transform(const R2Transformation& transformation) 118 | { 119 | // Transform each axis 120 | axis[0].Transform(transformation); 121 | axis[1].Transform(transformation); 122 | } 123 | 124 | 125 | 126 | void R2Diad:: 127 | InverseTransform(const R2Transformation& transformation) 128 | { 129 | // Transform each axis 130 | axis[0].InverseTransform(transformation); 131 | axis[1].InverseTransform(transformation); 132 | } 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Diad.h: -------------------------------------------------------------------------------- 1 | /* Include file for the GAPS diad class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitDiad(); 8 | void R2StopDiad(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Diad /* : public R2Base */ { 15 | public: 16 | // Constructor functions 17 | R2Diad(void); 18 | R2Diad(const R2Diad& diad); 19 | R2Diad(const R2Vector& xaxis, const R2Vector& yaxis); 20 | 21 | // Property functions/operators 22 | const R3Matrix Matrix(void) const; 23 | const R3Matrix InverseMatrix(void) const; 24 | const R2Vector& Axis(RNDimension dim) const; 25 | const R2Vector& operator[](RNDimension dim) const; 26 | const RNBoolean operator==(const R2Diad& diad) const; 27 | const RNBoolean operator!=(const R2Diad& diad) const; 28 | 29 | // Manipulation functions/operators 30 | void Normalize(void); 31 | void Rotate(RNAngle radians); 32 | void Mirror(const R2Line& line); 33 | void Transform(const R2Transformation& transformation); 34 | void InverseTransform(const R2Transformation& transformation); 35 | R2Diad& operator=(const R2Diad& diad); 36 | 37 | // Draw functions/operators 38 | void Draw(void) const; 39 | void Outline(void) const; 40 | 41 | private: 42 | R2Vector axis[2]; 43 | }; 44 | 45 | 46 | 47 | /* Public variables */ 48 | 49 | extern const R2Diad R2xy_diad; 50 | 51 | 52 | 53 | /* Inline functions */ 54 | 55 | inline const R2Vector& R2Diad:: 56 | Axis(RNDimension dim) const 57 | { 58 | // Return axis vector 59 | assert((dim >= RN_X) && (dim <= RN_Y)); 60 | return axis[dim]; 61 | } 62 | 63 | 64 | 65 | inline const R2Vector& R2Diad:: 66 | operator[](RNDimension dim) const 67 | { 68 | // Return axis vector 69 | return Axis(dim); 70 | } 71 | 72 | 73 | 74 | inline const RNBoolean R2Diad:: 75 | operator==(const R2Diad& diad) const 76 | { 77 | // Return whether diad is equal 78 | // We can check only one of the three since everything is orthonormal 79 | return (axis[0] == diad.axis[0]); 80 | } 81 | 82 | 83 | 84 | inline const RNBoolean R2Diad:: 85 | operator!=(const R2Diad& diad) const 86 | { 87 | // Return whether diad is not equal 88 | return !(*this == diad); 89 | } 90 | 91 | 92 | 93 | inline void R2Diad:: 94 | Outline(void) const 95 | { 96 | // Draw diad 97 | Draw(); 98 | } 99 | 100 | 101 | 102 | inline R2Diad& R2Diad:: 103 | operator=(const R2Diad& diad) 104 | { 105 | axis[0] = diad.axis[0]; 106 | axis[1] = diad.axis[1]; 107 | return *this; 108 | } 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Draw.h: -------------------------------------------------------------------------------- 1 | /* Include file for R2 draw utility */ 2 | 3 | 4 | 5 | inline void 6 | R2LoadPoint(const R2Point& point) 7 | { 8 | // Load vertex 9 | R2LoadPoint(point.Coords()); 10 | } 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Halfspace.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS halfspace class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public variables */ 12 | 13 | const R2Halfspace R2null_halfspace(0.0, 0.0, 0.0); 14 | const R2Halfspace R2posx_halfspace(1.0, 0.0, 0.0); 15 | const R2Halfspace R2posy_halfspace(0.0, 1.0, 0.0); 16 | const R2Halfspace R2negx_halfspace(-1.0, 0.0, 0.0); 17 | const R2Halfspace R2negy_halfspace(0.0, -1.0, 0.0); 18 | 19 | 20 | 21 | /* Public functions */ 22 | 23 | int 24 | R2InitHalfspace() 25 | { 26 | /* Return success */ 27 | return TRUE; 28 | } 29 | 30 | 31 | 32 | void 33 | R2StopHalfspace() 34 | { 35 | } 36 | 37 | 38 | 39 | R2Halfspace:: 40 | R2Halfspace (void) 41 | { 42 | } 43 | 44 | 45 | 46 | R2Halfspace:: 47 | R2Halfspace (const R2Halfspace& halfspace) 48 | : line(halfspace.line) 49 | { 50 | } 51 | 52 | 53 | 54 | R2Halfspace:: 55 | R2Halfspace(RNScalar a, RNScalar b, RNScalar c) 56 | : line(a, b, c) 57 | { 58 | } 59 | 60 | 61 | 62 | R2Halfspace:: 63 | R2Halfspace(const RNScalar a[3]) 64 | : line(a) 65 | { 66 | } 67 | 68 | 69 | 70 | R2Halfspace:: 71 | R2Halfspace(const R2Point& point, const R2Vector& normal) 72 | : line(point, R2Vector(-normal.Y(), normal.X())) 73 | { 74 | } 75 | 76 | 77 | 78 | R2Halfspace:: 79 | R2Halfspace(const R2Point& point1, const R2Point& point2) 80 | : line(point1, point2) 81 | { 82 | } 83 | 84 | 85 | 86 | R2Halfspace:: 87 | R2Halfspace(const R2Line& line, int ) 88 | : line(line) 89 | { 90 | } 91 | 92 | 93 | 94 | void R2Halfspace:: 95 | Mirror (const R2Line& line) 96 | { 97 | // Mirror halfspace with respect to line 98 | this->line.Mirror(line); 99 | } 100 | 101 | 102 | 103 | void R2Halfspace:: 104 | Transform (const R2Transformation& transformation) 105 | { 106 | // Transform halfspace 107 | line.Transform(transformation); 108 | } 109 | 110 | 111 | 112 | void R2Halfspace:: 113 | InverseTransform (const R2Transformation& transformation) 114 | { 115 | // Transform halfspace 116 | line.InverseTransform(transformation); 117 | } 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Io.h: -------------------------------------------------------------------------------- 1 | /* Include file for input/output utility */ 2 | 3 | 4 | 5 | /* Function declarations */ 6 | 7 | RNArray *R2ReadSpans(RNArray& spans, const char *filename); 8 | RNArray *R2ReadWiseFile(RNArray& spans, const char *filename); 9 | RNArray *R2ReadXFigFile(RNArray& spans, const char *filename); 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Parall.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS parallel utility */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | RNBoolean R2Parallel(const R2Vector& vector1, const R2Vector& vector2) 12 | { 13 | // Return whether two vectors are coincident (or anti-coincident) 14 | if ((RNIsEqual(vector1.X(), vector2.X())) && 15 | (RNIsEqual(vector1.Y(), vector2.Y()))) return TRUE; 16 | if ((RNIsEqual(vector1.X(), -vector2.X())) && 17 | (RNIsEqual(vector1.Y(), -vector2.Y()))) return TRUE; 18 | return FALSE; 19 | } 20 | 21 | 22 | 23 | RNBoolean R2Parallel(const R2Vector& vector, const R2Line& line) 24 | { 25 | // Return whether vector and line are parallel 26 | return R2Parallel(vector, line.Vector()); 27 | } 28 | 29 | 30 | 31 | RNBoolean R2Parallel(const R2Vector& vector, const R2Ray& ray) 32 | { 33 | // Return whether vector and ray are parallel 34 | return R2Parallel(vector, ray.Vector()); 35 | } 36 | 37 | 38 | 39 | RNBoolean R2Parallel(const R2Vector& vector, const R2Span& span) 40 | { 41 | // Return whether vector and span are parallel 42 | return R2Parallel(vector, span.Vector()); 43 | } 44 | 45 | 46 | 47 | RNBoolean R2Parallel(const R2Line& line1, const R2Line& line2) 48 | { 49 | // Return whether line1 and line2 are parallel 50 | return R2Parallel(line1.Vector(), line2.Vector()); 51 | } 52 | 53 | 54 | 55 | RNBoolean R2Parallel(const R2Line& line, const R2Ray& ray) 56 | { 57 | // Return whether line and ray are parallel 58 | return R2Parallel(line.Vector(), ray.Vector()); 59 | } 60 | 61 | 62 | 63 | RNBoolean R2Parallel(const R2Line& line, const R2Span& span) 64 | { 65 | // Return whether line and span are parallel 66 | return R2Parallel(line.Vector(), span.Vector()); 67 | } 68 | 69 | 70 | 71 | RNBoolean R2Parallel(const R2Ray& ray1, const R2Ray& ray2) 72 | { 73 | // Return whether ray1 and ray2 are parallel 74 | return R2Parallel(ray1.Vector(), ray2.Vector()); 75 | } 76 | 77 | 78 | 79 | RNBoolean R2Parallel(const R2Ray& ray, const R2Span& span) 80 | { 81 | // Return whether ray and span are parallel 82 | return R2Parallel(ray.Vector(), span.Vector()); 83 | } 84 | 85 | 86 | 87 | RNBoolean R2Parallel(const R2Span& span1, const R2Span& span2) 88 | { 89 | // Return whether span1 and span2 are parallel 90 | return R2Parallel(span1.Vector(), span2.Vector()); 91 | } 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Parall.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS parallel utility */ 2 | 3 | 4 | 5 | /* Function declarations */ 6 | 7 | RNBoolean R2Parallel(const R2Vector& vector1, const R2Vector& vector2); 8 | RNBoolean R2Parallel(const R2Vector& vector, const R2Line& line); 9 | RNBoolean R2Parallel(const R2Vector& vector, const R2Ray& ray); 10 | RNBoolean R2Parallel(const R2Vector& vector, const R2Span& span); 11 | 12 | RNBoolean R2Parallel(const R2Line& line, const R2Vector& vector); 13 | RNBoolean R2Parallel(const R2Line& line1, const R2Line& line2); 14 | RNBoolean R2Parallel(const R2Line& line, const R2Ray& ray); 15 | RNBoolean R2Parallel(const R2Line& line, const R2Span& span); 16 | 17 | RNBoolean R2Parallel(const R2Ray& ray, const R2Vector& vector); 18 | RNBoolean R2Parallel(const R2Ray& ray, const R2Line& line); 19 | RNBoolean R2Parallel(const R2Ray& ray1, const R2Ray& ray2); 20 | RNBoolean R2Parallel(const R2Ray& ray, const R2Span& span); 21 | 22 | RNBoolean R2Parallel(const R2Span& span, const R2Vector& vector); 23 | RNBoolean R2Parallel(const R2Span& span, const R2Line& line); 24 | RNBoolean R2Parallel(const R2Span& span, const R2Ray& ray); 25 | RNBoolean R2Parallel(const R2Span& span1, const R2Span& span2); 26 | 27 | 28 | 29 | /* Inline functions */ 30 | 31 | inline RNBoolean R2Parallel(const R2Line& line, const R2Vector& vector) 32 | { 33 | // Parallel is commutative 34 | return R2Parallel(vector, line); 35 | } 36 | 37 | 38 | 39 | inline RNBoolean R2Parallel(const R2Ray& ray, const R2Vector& vector) 40 | { 41 | // Parallel is commutative 42 | return R2Parallel(vector, ray); 43 | } 44 | 45 | 46 | 47 | inline RNBoolean R2Parallel(const R2Ray& ray, const R2Line& line) 48 | { 49 | // Parallel is commutative 50 | return R2Parallel(line, ray); 51 | } 52 | 53 | 54 | 55 | inline RNBoolean R2Parallel(const R2Span& span, const R2Vector& vector) 56 | { 57 | // Parallel is commutative 58 | return R2Parallel(vector, span); 59 | } 60 | 61 | 62 | 63 | inline RNBoolean R2Parallel(const R2Span& span, const R2Line& line) 64 | { 65 | // Parallel is commutative 66 | return R2Parallel(line, span); 67 | } 68 | 69 | 70 | 71 | inline RNBoolean R2Parallel(const R2Span& span, const R2Ray& ray) 72 | { 73 | // Parallel is commutative 74 | return R2Parallel(ray, span); 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Perp.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS perpendicular utility */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | RNBoolean R2Perpendicular(const R2Vector& vector1, const R2Vector& vector2) 12 | { 13 | // Normalized vectors ??? 14 | // Return whether vector1 and vector2 are perpendicular 15 | return RNIsZero(vector1.Dot(vector2)); 16 | } 17 | 18 | 19 | 20 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Line& line) 21 | { 22 | // Return whether vector and line are perpendicular 23 | return R2Perpendicular(vector, line.Vector()); 24 | } 25 | 26 | 27 | 28 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Ray& ray) 29 | { 30 | // Return whether vector and ray are perpendicular 31 | return R2Perpendicular(vector, ray.Vector()); 32 | } 33 | 34 | 35 | 36 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Span& span) 37 | { 38 | // Return whether vector and span are perpendicular 39 | return R2Perpendicular(vector, span.Vector()); 40 | } 41 | 42 | 43 | 44 | RNBoolean R2Perpendicular(const R2Line& line1, const R2Line& line2) 45 | { 46 | // Return whether line1 and line2 are perpendicular 47 | return R2Perpendicular(line1.Vector(), line2.Vector()); 48 | } 49 | 50 | 51 | 52 | RNBoolean R2Perpendicular(const R2Line& line, const R2Ray& ray) 53 | { 54 | // Return whether line and ray are perpendicular 55 | return R2Perpendicular(line.Vector(), ray.Vector()); 56 | } 57 | 58 | 59 | 60 | RNBoolean R2Perpendicular(const R2Line& line, const R2Span& span) 61 | { 62 | // Return whether line and span are perpendicular 63 | return R2Perpendicular(line.Vector(), span.Vector()); 64 | } 65 | 66 | 67 | 68 | RNBoolean R2Perpendicular(const R2Ray& ray1, const R2Ray& ray2) 69 | { 70 | // Return whether ray1 and ray2 are perpendicular 71 | return R2Perpendicular(ray1.Vector(), ray2.Vector()); 72 | } 73 | 74 | 75 | 76 | RNBoolean R2Perpendicular(const R2Ray& ray, const R2Span& span) 77 | { 78 | // Return whether ray and span are perpendicular 79 | return R2Perpendicular(ray.Vector(), span.Vector()); 80 | } 81 | 82 | 83 | 84 | RNBoolean R2Perpendicular(const R2Span& span1, const R2Span& span2) 85 | { 86 | // Return whether span1 and span2 are perpendicular 87 | return R2Perpendicular(span1.Vector(), span2.Vector()); 88 | } 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Perp.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS perpendicular utility */ 2 | 3 | 4 | 5 | /* Function declarations */ 6 | 7 | RNBoolean R2Perpendicular(const R2Vector& vector1, const R2Vector& vector2); 8 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Line& line); 9 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Ray& ray); 10 | RNBoolean R2Perpendicular(const R2Vector& vector, const R2Span& span); 11 | 12 | RNBoolean R2Perpendicular(const R2Line& line, const R2Vector& vector); 13 | RNBoolean R2Perpendicular(const R2Line& line1, const R2Line& line2); 14 | RNBoolean R2Perpendicular(const R2Line& line, const R2Ray& ray); 15 | RNBoolean R2Perpendicular(const R2Line& line, const R2Span& span); 16 | 17 | RNBoolean R2Perpendicular(const R2Ray& ray, const R2Vector& vector); 18 | RNBoolean R2Perpendicular(const R2Ray& ray, const R2Line& line); 19 | RNBoolean R2Perpendicular(const R2Ray& ray1, const R2Ray& ray2); 20 | RNBoolean R2Perpendicular(const R2Ray& ray, const R2Span& span); 21 | 22 | RNBoolean R2Perpendicular(const R2Span& span, const R2Vector& vector); 23 | RNBoolean R2Perpendicular(const R2Span& span, const R2Line& line); 24 | RNBoolean R2Perpendicular(const R2Span& span, const R2Ray& ray); 25 | RNBoolean R2Perpendicular(const R2Span& span1, const R2Span& span2); 26 | 27 | 28 | 29 | /* Inline functions */ 30 | 31 | inline RNBoolean R2Perpendicular(const R2Line& line, const R2Vector& vector) 32 | { 33 | // Perpendicular is commutative 34 | return R2Perpendicular(vector, line); 35 | } 36 | 37 | 38 | 39 | inline RNBoolean R2Perpendicular(const R2Ray& ray, const R2Vector& vector) 40 | { 41 | // Perpendicular is commutative 42 | return R2Perpendicular(vector, ray); 43 | } 44 | 45 | 46 | 47 | inline RNBoolean R2Perpendicular(const R2Ray& ray, const R2Line& line) 48 | { 49 | // Perpendicular is commutative 50 | return R2Perpendicular(line, ray); 51 | } 52 | 53 | 54 | 55 | inline RNBoolean R2Perpendicular(const R2Span& span, const R2Vector& vector) 56 | { 57 | // Perpendicular is commutative 58 | return R2Perpendicular(vector, span); 59 | } 60 | 61 | 62 | 63 | inline RNBoolean R2Perpendicular(const R2Span& span, const R2Line& line) 64 | { 65 | // Perpendicular is commutative 66 | return R2Perpendicular(line, span); 67 | } 68 | 69 | 70 | 71 | inline RNBoolean R2Perpendicular(const R2Span& span, const R2Ray& ray) 72 | { 73 | // Perpendicular is commutative 74 | return R2Perpendicular(ray, span); 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Relate.h: -------------------------------------------------------------------------------- 1 | /* Include file for R2 miscelleaneous relationship utility */ 2 | 3 | 4 | 5 | /* Miscellaneous relationship function declarations */ 6 | 7 | RNAngle R2InteriorAngle(const R2Vector& vector1, const R2Vector& vector2); 8 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Line& line); 9 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Ray& ray); 10 | RNAngle R2InteriorAngle(const R2Vector& vector, const R2Span& span); 11 | 12 | RNArea R2IntersectionArea(const R2Box& box1, const R2Box& box2); 13 | RNArea R2IntersectionArea(const R2Circle& circle1, const R2Circle& circle2); 14 | 15 | RNBoolean R2Abuts(const R2Box& box1, const R2Box& box2); 16 | 17 | int R2Splits(const R2Line& line, const R2Span& span); 18 | int R2Splits(const R2Line& line, const R2Span& span, R2Span *below_result, R2Span *above_result = NULL); 19 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shape.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 shape class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public draw flags */ 12 | 13 | const R2DrawFlags R2_EDGES_DRAW_FLAG (0x001); 14 | const R2DrawFlags R2_SURFACES_DRAW_FLAG (0x002); 15 | const R2DrawFlags R2_NULL_DRAW_FLAGS (0x000); 16 | const R2DrawFlags R2_EVERYTHING_DRAW_FLAGS (0xFFF); 17 | const R2DrawFlags R2_DEFAULT_DRAW_FLAGS (R2_EVERYTHING_DRAW_FLAGS); 18 | 19 | 20 | 21 | /* Public functions */ 22 | 23 | int 24 | R2InitShape() 25 | { 26 | /* Return success */ 27 | return TRUE; 28 | } 29 | 30 | 31 | 32 | void 33 | R2StopShape() 34 | { 35 | } 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shape.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 shape class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitShape(); 8 | void R2StopShape(); 9 | 10 | 11 | 12 | /* Draw flags definition */ 13 | 14 | typedef RNFlags R2DrawFlags; 15 | extern const R2DrawFlags R2_EDGES_DRAW_FLAG; 16 | extern const R2DrawFlags R2_SURFACES_DRAW_FLAG; 17 | extern const R2DrawFlags R2_NULL_DRAW_FLAGS; 18 | extern const R2DrawFlags R2_EVERYTHING_DRAW_FLAGS; 19 | extern const R2DrawFlags R2_DEFAULT_DRAW_FLAGS; 20 | 21 | 22 | 23 | /* Class definition */ 24 | 25 | class R2Shape /* : public R2Base */ { 26 | public: 27 | // Constructors/destructors 28 | virtual ~R2Shape(void) {}; 29 | 30 | // Draw functions/operators 31 | virtual void Draw(const R2DrawFlags draw_flags = R2_DEFAULT_DRAW_FLAGS) const = 0; 32 | void Outline(void) const { Draw(R2_EDGES_DRAW_FLAG); }; 33 | }; 34 | 35 | 36 | 37 | /* Shape type enumeration ??? */ 38 | 39 | enum { 40 | R2_POINT_CLASS_ID = 1, 41 | R2_LINE_CLASS_ID = 2, 42 | R2_RAY_CLASS_ID = 3, 43 | R2_SPAN_CLASS_ID = 4, 44 | R2_POLYGON_CLASS_ID = 6 45 | }; 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shapes.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS shapes module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R2shapes_active_count = 0; 14 | 15 | 16 | 17 | int R2InitShapes(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R2shapes_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!RNInitBasics()) return FALSE; 24 | 25 | // Initialize submodules 26 | if (!R2InitCircle()) return FALSE; 27 | 28 | // return OK status 29 | return TRUE; 30 | } 31 | 32 | 33 | 34 | void R2StopShapes(void) 35 | { 36 | // Check whether have been initialized 37 | if ((--R2shapes_active_count) > 0) return; 38 | 39 | // Stop submodules 40 | R2StopCircle(); 41 | 42 | // Stop dependencies 43 | RNStopBasics(); 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Shapes.h: -------------------------------------------------------------------------------- 1 | /* Include file for R2 shapes module */ 2 | 3 | #ifndef __R2__SHAPES__H__ 4 | #define __R2__SHAPES__H__ 5 | 6 | 7 | 8 | /* Dependency include files */ 9 | 10 | #include "RNBasics/RNBasics.h" 11 | 12 | 13 | 14 | /* Class declarations */ 15 | 16 | class R2Vector; 17 | class R2Point; 18 | class R2Line; 19 | class R2Ray; 20 | class R2Span; 21 | class R2Halfspace; 22 | class R3Matrix; 23 | class R2Diad; 24 | class R2CoordSystem; 25 | class R2Transformation; 26 | class R2Affine; 27 | class R2Arc; 28 | class R2Polyline; 29 | class R2Box; 30 | class R2Circle; 31 | class R2Polygon; 32 | class R2Grid; 33 | 34 | 35 | 36 | /* Image include files */ 37 | 38 | #include "R2Shapes/R2Image.h" 39 | 40 | 41 | 42 | /* Primitive shape include files */ 43 | 44 | #include "R2Shapes/R2Vector.h" 45 | #include "R2Shapes/R2Point.h" 46 | #include "R2Shapes/R2Line.h" 47 | #include "R2Shapes/R2Ray.h" 48 | #include "R2Shapes/R2Span.h" 49 | #include "R2Shapes/R2Halfspace.h" 50 | 51 | 52 | 53 | /* Transformation include files */ 54 | 55 | #include "R2Shapes/R3Matrix.h" 56 | #include "R2Shapes/R2Diad.h" 57 | #include "R2Shapes/R2Crdsys.h" 58 | #include "R2Shapes/R2Xform.h" 59 | #include "R2Shapes/R2Affine.h" 60 | 61 | 62 | 63 | /* Abstract shape include file */ 64 | 65 | #include "R2Shapes/R2Shape.h" 66 | 67 | 68 | 69 | /* Solid shapes include files */ 70 | 71 | #include "R2Shapes/R2Solid.h" 72 | #include "R2Shapes/R2Box.h" 73 | #include "R2Shapes/R2Circle.h" 74 | #include "R2Shapes/R2Polygon.h" 75 | 76 | 77 | 78 | /* Curve shapes include files */ 79 | 80 | #include "R2Shapes/R2Curve.h" 81 | #include "R2Shapes/R2Arc.h" 82 | #include "R2Shapes/R2Polyline.h" 83 | 84 | 85 | 86 | /* Solid shapes include files */ 87 | 88 | #include "R2Shapes/R2Grid.h" 89 | 90 | 91 | 92 | /* Shape relationship include files */ 93 | 94 | #include "R2Shapes/R2Perp.h" 95 | #include "R2Shapes/R2Parall.h" 96 | #include "R2Shapes/R2Dist.h" 97 | #include "R2Shapes/R2Cont.h" 98 | #include "R2Shapes/R2Isect.h" 99 | #include "R2Shapes/R2Relate.h" 100 | #include "R2Shapes/R2Align.h" 101 | 102 | 103 | 104 | /* Closest point search include files */ 105 | 106 | #include "R2Shapes/R2Kdtree.h" 107 | 108 | 109 | 110 | /* Shape utility include files */ 111 | 112 | #include "R2Shapes/R2Draw.h" 113 | #include "R2Shapes/R2Io.h" 114 | 115 | 116 | 117 | /* Initialization functions */ 118 | 119 | int R2InitShapes(void); 120 | void R2StopShapes(void); 121 | 122 | 123 | 124 | #endif 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Solid.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 solid class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R2InitSolid() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R2StopSolid() 24 | { 25 | } 26 | 27 | 28 | 29 | R2Solid:: 30 | R2Solid(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R2Solid:: 37 | ~R2Solid(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R2Solid:: 44 | IsSolid(void) const 45 | { 46 | // All solid shapes are solids 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Solid.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 solid class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitSolid(); 8 | void R2StopSolid(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Solid : public R2Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R2Solid(void); 18 | ~R2Solid(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSolid(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Xform.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R2 transformation class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R2Shapes/R2Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R2InitTransformation() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R2StopTransformation() 24 | { 25 | } 26 | 27 | 28 | 29 | R2Transformation:: 30 | ~R2Transformation(void) 31 | { 32 | } 33 | 34 | 35 | 36 | const RNBoolean R2Transformation:: 37 | IsMirrored(void) const 38 | { 39 | // Return whether transformation is mirrored (default is FALSE) 40 | return FALSE; 41 | } 42 | 43 | 44 | 45 | const RNBoolean R2Transformation:: 46 | IsLinear(void) const 47 | { 48 | // Return whether transformation is linear (default is FALSE) 49 | return FALSE; 50 | } 51 | 52 | 53 | 54 | const RNBoolean R2Transformation:: 55 | IsAffine(void) const 56 | { 57 | // Return whether transformation is affine (default is FALSE) 58 | return FALSE; 59 | } 60 | 61 | 62 | 63 | const RNBoolean R2Transformation:: 64 | IsIsotropic(void) const 65 | { 66 | // Return whether transformation is isotropic (default is FALSE) 67 | return FALSE; 68 | } 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /gaps/pkgs/R2Shapes/R2Xform.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R2 transformation class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R2InitTransformation(); 8 | void R2StopTransformation(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R2Transformation /* : public R2Base */ { 15 | public: 16 | // Destructor function 17 | virtual ~R2Transformation(void); 18 | 19 | // Property functions/operators 20 | virtual const RNBoolean IsMirrored(void) const; 21 | virtual const RNBoolean IsLinear(void) const; 22 | virtual const RNBoolean IsAffine(void) const; 23 | virtual const RNBoolean IsIsotropic(void) const; 24 | 25 | // Application functions/operators 26 | virtual void Apply(R2Vector& vector) const = 0; 27 | virtual void Apply(R2Point& point) const = 0; 28 | virtual void Apply(R2Transformation& transformation) const = 0; 29 | virtual void Apply(R2Affine& affine) const = 0; 30 | virtual void ApplyInverse(R2Vector& vector) const = 0; 31 | virtual void ApplyInverse(R2Point& point) const = 0; 32 | virtual void ApplyInverse(R2Transformation& transformation) const = 0; 33 | virtual void ApplyInverse(R2Affine& affine) const = 0; 34 | 35 | // Manipulation functions/operators 36 | virtual void Reset(const R2Transformation& transformation) = 0; 37 | virtual void Transform(const R2Transformation& transformation) = 0; 38 | virtual void InverseTransform(const R2Transformation& transformation) = 0; 39 | 40 | // Draw functions/operators 41 | virtual void Load(void) const = 0; 42 | virtual void Draw(void) const = 0; 43 | virtual void Push(void) const = 0; 44 | virtual void Pop(void) const = 0; 45 | }; 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R3Graphics 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | R3Scene.cpp R3SceneNode.cpp R3SceneElement.cpp R3SceneReference.cpp \ 15 | R3Viewer.cpp R3Frustum.cpp R3Camera.cpp R2Viewport.cpp \ 16 | R3AreaLight.cpp R3SpotLight.cpp R3PointLight.cpp R3DirectionalLight.cpp R3Light.cpp \ 17 | R3Material.cpp R3Brdf.cpp R2Texture.cpp \ 18 | json.cpp 19 | 20 | 21 | 22 | # 23 | # Dependencies 24 | # 25 | 26 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics 27 | 28 | 29 | 30 | # 31 | # PKG makefile 32 | # 33 | 34 | include ../../makefiles/Makefile.pkgs 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R2Viewport.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the viewport class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Graphics.h" 8 | 9 | 10 | 11 | /* Public variables */ 12 | 13 | R2Viewport R2default_viewport(0, 0, 128, 128); 14 | 15 | 16 | 17 | int R3InitViewport() 18 | { 19 | /* Return OK status */ 20 | return TRUE; 21 | } 22 | 23 | 24 | 25 | void R3StopViewport() 26 | { 27 | } 28 | 29 | 30 | 31 | R2Viewport:: 32 | R2Viewport(void) 33 | { 34 | } 35 | 36 | 37 | 38 | R2Viewport:: 39 | R2Viewport (int xmin, int ymin, int width, int height) 40 | : xmin(xmin), 41 | ymin(ymin), 42 | width(width), 43 | height(height) 44 | { 45 | } 46 | 47 | 48 | 49 | void R2Viewport:: 50 | Move(int xmin, int ymin) 51 | { 52 | // Set viewport variables 53 | this->xmin = xmin; 54 | this->ymin = ymin; 55 | } 56 | 57 | 58 | 59 | void R2Viewport:: 60 | Resize(int width, int height) 61 | { 62 | // Set viewport variables 63 | this->width = width; 64 | this->height = height; 65 | } 66 | 67 | 68 | 69 | void R2Viewport:: 70 | Resize(int xmin, int ymin, int width, int height) 71 | { 72 | // Set viewport variables 73 | this->xmin = xmin; 74 | this->ymin = ymin; 75 | this->width = width; 76 | this->height = height; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3DirectionalLight.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 light class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitDirectionalLight(); 8 | void R3StopDirectionalLight(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3DirectionalLight : public R3Light { 15 | public: 16 | // Constructor functions 17 | R3DirectionalLight(void); 18 | R3DirectionalLight(const R3DirectionalLight& light); 19 | R3DirectionalLight(const R3Vector& direction, const RNRgb& color, 20 | RNScalar intensity = 1.0, RNBoolean active = TRUE); 21 | 22 | // Property functions/operators 23 | const R3Vector& Direction(void) const; 24 | 25 | // Manipulation functions/operations 26 | virtual void SetDirection(const R3Vector& direction); 27 | virtual void Transform(const R3Transformation& transformation); 28 | 29 | // Geometry evaluation functions 30 | virtual RNScalar IntensityAtPoint(const R3Point& point) const; 31 | virtual R3Vector DirectionFromPoint(const R3Point& point) const; 32 | virtual RNScalar RadiusOfInfluence(RNScalar intensity) const; 33 | virtual R3Sphere SphereOfInfluence(RNScalar intensity) const; 34 | 35 | // Reflection evaluation functions 36 | virtual RNRgb Reflection(const R3Brdf& brdf, const R3Point& eye, 37 | const R3Point& point, const R3Vector& normal) const; 38 | virtual RNRgb DiffuseReflection(const R3Brdf& brdf, 39 | const R3Point& point, const R3Vector& normal) const; 40 | virtual RNRgb SpecularReflection(const R3Brdf& brdf, const R3Point& eye, 41 | const R3Point& point, const R3Vector& normal) const; 42 | 43 | // Draw functions/operations 44 | virtual void Draw(int i) const; 45 | 46 | // Class type definitions 47 | RN_CLASS_TYPE_DECLARATIONS(R3DirectionalLight); 48 | 49 | private: 50 | R3Vector direction; 51 | }; 52 | 53 | 54 | 55 | /* Public variables */ 56 | 57 | extern R3DirectionalLight R3null_directional_light; 58 | extern R3DirectionalLight R3default_directional_light; 59 | 60 | 61 | 62 | /* Inline functions */ 63 | 64 | inline const R3Vector& R3DirectionalLight:: 65 | Direction(void) const 66 | { 67 | // Return direction 68 | return direction; 69 | } 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3Frustum.h: -------------------------------------------------------------------------------- 1 | // Include file for R3 view frustum class 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // Class definition 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | struct R3Frustum { 10 | public: 11 | // Constructor 12 | R3Frustum(void); 13 | R3Frustum(const R3Camera& camera); 14 | R3Frustum(const R3Point& viewpoint, const R3Vector& towards, 15 | const R3Vector& up, RNAngle xfov, RNAngle yfov, 16 | RNLength neardist, RNLength fardist); 17 | 18 | // Property functions 19 | const R3Camera& Camera(void) const; 20 | const R3Halfspace& Halfspace(int dir, int dim) const; 21 | 22 | // Manipulation functions 23 | void SetCamera(const R3Camera& camera); 24 | 25 | // Intersection/containment functions 26 | RNBoolean Intersects(const R3Point& point) const; 27 | RNBoolean Intersects(const R3Span& span) const; 28 | RNBoolean Intersects(const R3Box& box) const; 29 | RNBoolean Contains(const R3Point& point) const; 30 | RNBoolean Contains(const R3Span& span) const; 31 | RNBoolean Contains(const R3Box& box) const; 32 | 33 | // Draw function 34 | void Draw(void) const; 35 | 36 | public: 37 | R3Camera camera; 38 | R3Halfspace halfspaces[2][3]; 39 | }; 40 | 41 | 42 | 43 | // Inline functions 44 | 45 | inline const R3Camera& R3Frustum:: 46 | Camera(void) const 47 | { 48 | // Return camera 49 | return camera; 50 | } 51 | 52 | 53 | 54 | inline const R3Halfspace& R3Frustum:: 55 | Halfspace(int dir, int dim) const 56 | { 57 | // Return halfspace 58 | return halfspaces[dir][dim]; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3Graphics.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS graphics module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Graphics.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R3graphics_active_count = 0; 14 | 15 | 16 | 17 | int R3InitGraphics(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R3graphics_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // Initialize submodules 26 | if (!R3InitMaterial()) return FALSE; 27 | 28 | // return OK status 29 | return TRUE; 30 | } 31 | 32 | 33 | 34 | void R3StopGraphics(void) 35 | { 36 | // Check whether have been initialized 37 | if ((--R3graphics_active_count) > 0) return; 38 | 39 | // Stop submodules 40 | R3StopMaterial(); 41 | 42 | // Stop dependencies 43 | R3StopShapes(); 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3Graphics.h: -------------------------------------------------------------------------------- 1 | /* Include file for R3 graphics module */ 2 | 3 | #ifndef __R3__GRAPHICS__H__ 4 | #define __R3__GRAPHICS__H__ 5 | 6 | 7 | 8 | /* Class declarations */ 9 | 10 | class R3Scene; 11 | class R3SceneNode; 12 | class R3SceneElement; 13 | 14 | 15 | 16 | /* Dependency include files */ 17 | 18 | #include "R3Shapes/R3Shapes.h" 19 | 20 | 21 | 22 | /* Material include files */ 23 | 24 | #include "R3Graphics/R3Brdf.h" 25 | #include "R3Graphics/R2Texture.h" 26 | #include "R3Graphics/R3Material.h" 27 | 28 | 29 | 30 | /* Light include files */ 31 | 32 | #include "R3Graphics/R3Light.h" 33 | #include "R3Graphics/R3DirectionalLight.h" 34 | #include "R3Graphics/R3PointLight.h" 35 | #include "R3Graphics/R3SpotLight.h" 36 | #include "R3Graphics/R3AreaLight.h" 37 | 38 | 39 | 40 | /* Viewing include files */ 41 | 42 | #include "R3Graphics/R2Viewport.h" 43 | #include "R3Graphics/R3Camera.h" 44 | #include "R3Graphics/R3Frustum.h" 45 | #include "R3Graphics/R3Viewer.h" 46 | 47 | 48 | 49 | /* Scene include files */ 50 | 51 | #include "R3Graphics/R3SceneReference.h" 52 | #include "R3Graphics/R3SceneElement.h" 53 | #include "R3Graphics/R3SceneNode.h" 54 | #include "R3Graphics/R3Scene.h" 55 | 56 | 57 | 58 | /* Initialization functions */ 59 | 60 | int R3InitGraphics(void); 61 | void R3StopGraphics(void); 62 | 63 | 64 | 65 | #endif 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3SceneReference.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 scene reference class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Graphics.h" 8 | 9 | 10 | 11 | /* Member functions */ 12 | 13 | R3SceneReference:: 14 | R3SceneReference(R3Scene *referenced_scene) 15 | : referenced_scene(referenced_scene), 16 | materials() 17 | { 18 | } 19 | 20 | 21 | 22 | R3SceneReference:: 23 | R3SceneReference(R3Scene *referenced_scene, const RNArray& materials) 24 | : referenced_scene(referenced_scene), 25 | materials() 26 | { 27 | // Copy pointers to materials 28 | this->materials = materials; 29 | } 30 | 31 | 32 | 33 | R3SceneReference:: 34 | ~R3SceneReference(void) 35 | { 36 | } 37 | 38 | 39 | 40 | void R3SceneReference:: 41 | Draw(const R3DrawFlags draw_flags, const RNArray *mats) const 42 | { 43 | // Check scene 44 | if (!referenced_scene) return; 45 | 46 | // Draw scene with materials 47 | referenced_scene->Root()->Draw(draw_flags, &materials); 48 | } 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3SceneReference.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 scene reference class */ 2 | 3 | 4 | 5 | /* Class definitions */ 6 | 7 | class R3SceneReference { 8 | public: 9 | // Constructor functions 10 | R3SceneReference(R3Scene *referenced_scene = NULL); 11 | R3SceneReference(R3Scene *referenced_scene, const RNArray& materials); 12 | ~R3SceneReference(void); 13 | 14 | // Access functions 15 | int NMaterials(void) const; 16 | R3Material *Material(int k) const; 17 | const RNArray& Materials(void) const; 18 | R3Scene *ReferencedScene(void) const; 19 | 20 | // Manipulation function 21 | void SetReferencedScene(R3Scene *scene); 22 | void InsertMaterial(R3Material *material); 23 | void ReplaceMaterial(int k, R3Material *material); 24 | 25 | // Draw functions 26 | void Draw(const R3DrawFlags draw_flags = R3_DEFAULT_DRAW_FLAGS, 27 | const RNArray *materials = NULL) const; 28 | 29 | private: 30 | R3Scene *referenced_scene; 31 | RNArray materials; 32 | }; 33 | 34 | 35 | 36 | /* Inline functions */ 37 | 38 | inline R3Scene *R3SceneReference:: 39 | ReferencedScene(void) const 40 | { 41 | // Return referenced scene 42 | return referenced_scene; 43 | } 44 | 45 | 46 | 47 | inline int R3SceneReference:: 48 | NMaterials(void) const 49 | { 50 | // Return number of materials 51 | return materials.NEntries(); 52 | } 53 | 54 | 55 | 56 | inline R3Material *R3SceneReference:: 57 | Material(int k) const 58 | { 59 | // Return material 60 | return materials.Kth(k); 61 | } 62 | 63 | 64 | 65 | inline const RNArray& R3SceneReference:: 66 | Materials(void) const 67 | { 68 | // Return materials 69 | return materials; 70 | } 71 | 72 | 73 | 74 | inline void R3SceneReference:: 75 | SetReferencedScene(R3Scene *scene) 76 | { 77 | // Set referenced scene 78 | this->referenced_scene = scene; 79 | } 80 | 81 | 82 | 83 | inline void R3SceneReference:: 84 | InsertMaterial(R3Material *material) 85 | { 86 | // Insert material 87 | materials.Insert(material); 88 | } 89 | 90 | 91 | 92 | inline void R3SceneReference:: 93 | ReplaceMaterial(int k, R3Material *material) 94 | { 95 | // Replace material 96 | RNArrayEntry *entry = materials.KthEntry(k); 97 | materials.EntryContents(entry) = material; 98 | } 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Graphics/R3SpotLight.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 light class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitSpotLight(); 8 | void R3StopSpotLight(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3SpotLight : public R3PointLight { 15 | public: 16 | // Constructor functions 17 | R3SpotLight(void); 18 | R3SpotLight(const R3SpotLight& light); 19 | R3SpotLight(const R3Point& position, const R3Vector& direction, 20 | const RNRgb& color, RNScalar dropoffrate = 0.0, RNAngle cutoffangle = 0.785398, 21 | RNScalar intensity = 1.0, RNBoolean active = TRUE, 22 | RNScalar ca = 0, RNScalar la = 0, RNScalar qa = 1); 23 | 24 | // Property functions/operators 25 | const R3Vector& Direction(void) const; 26 | const RNScalar DropOffRate(void) const; 27 | const RNAngle CutOffAngle(void) const; 28 | 29 | // Manipulation functions/operations 30 | virtual void SetDirection(const R3Vector& direction); 31 | virtual void SetDropOffRate(RNScalar dropoffrate); 32 | virtual void SetCutOffAngle(RNAngle cutoffangle); 33 | virtual void Transform(const R3Transformation& transformation); 34 | 35 | // Evaluation functions 36 | virtual RNScalar IntensityAtPoint(const R3Point& point) const; 37 | 38 | // Draw functions/operations 39 | virtual void Draw(int i) const; 40 | 41 | // Class type definitions 42 | RN_CLASS_TYPE_DECLARATIONS(R3SpotLight); 43 | 44 | private: 45 | R3Vector direction; 46 | RNScalar dropoffrate; 47 | RNAngle cutoffangle; 48 | }; 49 | 50 | 51 | 52 | /* Public variables */ 53 | 54 | extern R3SpotLight R3null_spot_light; 55 | 56 | 57 | 58 | /* Inline functions */ 59 | 60 | inline const R3Vector& R3SpotLight:: 61 | Direction(void) const 62 | { 63 | // Return direction 64 | return direction; 65 | } 66 | 67 | 68 | 69 | inline const RNScalar R3SpotLight:: 70 | DropOffRate(void) const 71 | { 72 | // Return drop off rate 73 | return dropoffrate; 74 | } 75 | 76 | 77 | 78 | inline const RNAngle R3SpotLight:: 79 | CutOffAngle(void) const 80 | { 81 | // Return cut off angle 82 | return cutoffangle; 83 | } 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R3Shapes 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | R3Draw.cpp \ 15 | R3MeshSearchTree.cpp R3MeshPropertySet.cpp R3MeshProperty.cpp \ 16 | R3Isect.cpp R3Cont.cpp R3Dist.cpp R3Parall.cpp R3Perp.cpp R3Relate.cpp R3Align.cpp R3Kdtree.cpp \ 17 | R3CatmullRomSpline.cpp R3Polyline.cpp R3Curve.cpp \ 18 | R3Mesh.cpp R3Rectangle.cpp R3Ellipse.cpp R3Circle.cpp R3TriangleArray.cpp R3Triangle.cpp R3Surface.cpp \ 19 | R3Ellipsoid.cpp R3Sphere.cpp R3Cone.cpp R3Cylinder.cpp R3OrientedBox.cpp R3Box.cpp R3Solid.cpp \ 20 | R3Shape.cpp \ 21 | R3Affine.cpp R3Xform.cpp R3Crdsys.cpp R3Triad.cpp R3Quaternion.cpp R4Matrix.cpp \ 22 | R3PlanarGrid.cpp R3Grid.cpp \ 23 | R3Halfspace.cpp R3Plane.cpp R3Span.cpp R3Ray.cpp R3Line.cpp R3Point.cpp R3Vector.cpp \ 24 | R3Base.cpp \ 25 | ply.cpp 26 | 27 | 28 | # 29 | # Dependencies 30 | # 31 | 32 | PKG_DEPENDENCIES = R2Shapes RNBasics 33 | 34 | 35 | 36 | # 37 | # PKG makefile 38 | # 39 | 40 | include ../../makefiles/Makefile.pkgs 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Align.h: -------------------------------------------------------------------------------- 1 | // Include file for alignment utility functions 2 | 3 | 4 | 5 | // Functions to align RNArray of points 6 | 7 | R3Point R3Centroid(const RNArray& points, const RNScalar *weights = NULL); 8 | R3Triad R3PrincipleAxes(const R3Point& centroid, const RNArray& points, const RNScalar *weights = NULL, RNScalar *variances = NULL); 9 | RNLength R3AverageDistance(const R3Point& center, const RNArray& points, const RNScalar *weights = NULL); 10 | R3Affine R3NormalizationTransformation(const RNArray& points, 11 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 12 | RNScalar R3AlignError(const RNArray& points1, const RNArray& points2, 13 | const R4Matrix& matrix = R4identity_matrix, const RNScalar* weights = NULL); 14 | R4Matrix R3AlignPoints(const RNArray& points1, const RNArray& points2, const RNScalar *weights = NULL, 15 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 16 | 17 | 18 | 19 | // Functions to align C array of points 20 | 21 | R3Point R3Centroid(int npoints, R3Point *points, const RNScalar *weights = NULL); 22 | R3Triad R3PrincipleAxes(const R3Point& centroid, int npoints, R3Point *points, const RNScalar *weights = NULL, RNScalar *variances = NULL); 23 | RNLength R3AverageDistance(const R3Point& center, int npoints, R3Point *points, const RNScalar *weights = NULL); 24 | R3Affine R3NormalizationTransformation(int npoints, R3Point *points, 25 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 26 | RNScalar R3AlignError(int npoints, R3Point *points1, R3Point *points2, 27 | const R4Matrix& matrix = R4identity_matrix, const RNScalar* weights = NULL); 28 | R4Matrix R3AlignPoints(int npoints, R3Point *points1, R3Point *points2, const RNScalar* weights = NULL, 29 | RNBoolean align_center = TRUE, RNBoolean align_rotation = TRUE, int align_scale = 1); 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Base.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS basics */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | 12 | /* Public draw flags */ 13 | 14 | #if FALSE 15 | 16 | const R3DrawFlags R3_EDGES_DRAW_FLAG (0x001); 17 | const R3DrawFlags R3_SURFACES_DRAW_FLAG (0x002); 18 | const R3DrawFlags R3_SURFACE_NORMALS_DRAW_FLAG (0x010); 19 | const R3DrawFlags R3_SURFACE_TEXTURE_DRAW_FLAG (0x020); 20 | const R3DrawFlags R3_VERTEX_NORMALS_DRAW_FLAG (0x100); 21 | const R3DrawFlags R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG (0x200); 22 | 23 | const R3DrawFlags R3_NULL_DRAW_FLAGS (0x000); 24 | const R3DrawFlags R3_EVERYTHING_DRAW_FLAGS (0xFFF); 25 | const R3DrawFlags R3_DEFAULT_DRAW_FLAGS (R3_EVERYTHING_DRAW_FLAGS & 26 | ~R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG & 27 | ~R3_EDGES_DRAW_FLAG); 28 | #endif 29 | 30 | 31 | 32 | int R3InitBase() 33 | { 34 | /* Return OK status */ 35 | return TRUE; 36 | } 37 | 38 | 39 | 40 | void R3StopBase() 41 | { 42 | } 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Base.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS basic stuff */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitBase(); 8 | void R3StopBase(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Base {}; 15 | 16 | 17 | 18 | /* Draw flags definition */ 19 | 20 | typedef RNFlags R3DrawFlags; 21 | #define R3_NULL_DRAW_FLAGS (0x000) 22 | #define R3_EDGES_DRAW_FLAG (0x001) 23 | #define R3_SURFACES_DRAW_FLAG (0x002) 24 | #define R3_SURFACE_NORMALS_DRAW_FLAG (0x010) 25 | #define R3_SURFACE_TEXTURE_DRAW_FLAG (0x020) 26 | #define R3_SURFACE_MATERIAL_DRAW_FLAG (0x040) 27 | #define R3_VERTEX_NORMALS_DRAW_FLAG (0x100) 28 | #define R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG (0x200) 29 | #define R3_EVERYTHING_DRAW_FLAGS (0x373) 30 | #define R3_DEFAULT_DRAW_FLAGS (R3_EVERYTHING_DRAW_FLAGS & ~R3_EDGES_DRAW_FLAG) 31 | 32 | #define R3_VERTEX_SHARED_FLAG (0x1000) 33 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3CatmullRomSpline.h: -------------------------------------------------------------------------------- 1 | /* Include file for the Catmull Rom spline class */ 2 | 3 | 4 | 5 | /* Class definition */ 6 | 7 | class R3CatmullRomSpline : public R3Polyline { 8 | public: 9 | // Constructor functions 10 | R3CatmullRomSpline(void); 11 | R3CatmullRomSpline(const R3CatmullRomSpline& curve); 12 | R3CatmullRomSpline(const RNArray& points, RNScalar tao = 0.5); 13 | R3CatmullRomSpline(const R3Point *points, int npoints, RNScalar tao = 0.5); 14 | R3CatmullRomSpline(const R3Point *points, const RNScalar *parameters, int npoints, RNScalar tao = 0.5); 15 | virtual ~R3CatmullRomSpline(void); 16 | 17 | // Spline properties 18 | int Order(void) const; 19 | 20 | // Vertex properties 21 | virtual R3Vector VertexDerivative(int k) const; 22 | 23 | // Point access 24 | virtual R3Point PointPosition(RNScalar u) const; 25 | virtual R3Vector PointDerivative(RNScalar u) const; 26 | 27 | // Draw functions 28 | virtual void Outline(const R3DrawFlags flags = R3_DEFAULT_DRAW_FLAGS) const; 29 | virtual void Outline(RNScalar sample_spacing) const; 30 | 31 | public: 32 | // Utility functions 33 | RNScalar BlendingWeight(RNScalar t, int k) const; 34 | RNScalar BlendingWeightDerivative(RNScalar t, int k) const; 35 | R3Point PhantomVertexPosition(int i, int j) const; 36 | 37 | private: 38 | // Upkeep functions 39 | virtual void UpdateBBox(void); 40 | 41 | private: 42 | RNScalar tao; 43 | }; 44 | 45 | 46 | 47 | /* Inline functions */ 48 | 49 | inline int R3CatmullRomSpline:: 50 | Order(void) const 51 | { 52 | // Return order of polynomial 53 | return 3; 54 | } 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Crdsys.h: -------------------------------------------------------------------------------- 1 | /* Include file for the GAPS coordinate system class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitCoordinateSystem(); 8 | void R3StopCoordinateSystem(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3CoordSystem /* : public R3Base */ { 15 | public: 16 | // Constructor functions 17 | R3CoordSystem(void); 18 | R3CoordSystem(const R3CoordSystem& cs); 19 | R3CoordSystem(const R3Point& origin, const R3Triad& axes); 20 | 21 | // Property functions/operators 22 | const R3Point& Origin(void) const; 23 | const R3Triad& Axes(void) const; 24 | const R4Matrix Matrix(void) const; 25 | const R4Matrix InverseMatrix(void) const; 26 | const RNBoolean operator==(const R3CoordSystem& cs) const; 27 | const RNBoolean operator!=(const R3CoordSystem& cs) const; 28 | 29 | // Manipulation functions/operators 30 | void Translate(const R3Vector& offset); 31 | void Rotate(RNAxis axis, RNAngle radians); 32 | void Rotate(const R3Vector& axis, RNAngle radians); 33 | void Rotate(const R3Vector& from, const R3Vector& to); 34 | void Mirror(const R3Plane& plane); 35 | void Transform(const R3Transformation& transformation); 36 | void InverseTransform(const R3Transformation& transformation); 37 | void SetOrigin(const R3Point& origin); 38 | void SetAxes(const R3Triad& axes); 39 | void Reset(const R3Point& origin, const R3Triad& axes); 40 | 41 | // Draw functions/operators 42 | void Draw(void) const; 43 | void Outline(void) const; 44 | 45 | private: 46 | R3Point origin; 47 | R3Triad axes; 48 | }; 49 | 50 | 51 | 52 | /* Public variables */ 53 | 54 | extern const R3CoordSystem R3xyz_coordinate_system; 55 | 56 | 57 | 58 | /* Inline functions */ 59 | 60 | inline const R3Point& R3CoordSystem:: 61 | Origin(void) const 62 | { 63 | // Return origin 64 | return origin; 65 | } 66 | 67 | 68 | 69 | inline const R3Triad& R3CoordSystem:: 70 | Axes(void) const 71 | { 72 | // Return axes triad 73 | return axes; 74 | } 75 | 76 | 77 | 78 | inline const RNBoolean R3CoordSystem:: 79 | operator==(const R3CoordSystem& cs) const 80 | { 81 | // Return whether coordinate system is equal 82 | return (origin == cs.origin) && (axes == cs.axes); 83 | } 84 | 85 | 86 | 87 | inline const RNBoolean R3CoordSystem:: 88 | operator!=(const R3CoordSystem& cs) const 89 | { 90 | // Return whether coordinate system is not equal 91 | return !(*this == cs); 92 | } 93 | 94 | 95 | 96 | inline void R3CoordSystem:: 97 | Outline(void) const 98 | { 99 | // Draw coordinate system 100 | Draw(); 101 | } 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Curve.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 curve class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitCurve() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopCurve() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Curve:: 30 | R3Curve(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R3Curve:: 37 | ~R3Curve(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const R3Point R3Curve:: 44 | StartPosition(void) const 45 | { 46 | // Return position at start of curve 47 | return PointPosition(StartParameter()); 48 | } 49 | 50 | 51 | 52 | const R3Point R3Curve:: 53 | EndPosition(void) const 54 | { 55 | // Return position at end of curve 56 | return PointPosition(EndParameter()); 57 | } 58 | 59 | 60 | 61 | R3Vector R3Curve:: 62 | PointDirection(RNScalar u) const 63 | { 64 | // Return tangent direction of curve at parametric value u 65 | R3Vector direction = PointDerivative(u); 66 | direction.Normalize(); 67 | return direction; 68 | } 69 | 70 | 71 | 72 | const RNBoolean R3Curve:: 73 | IsCurve(void) const 74 | { 75 | // All curve shapes are curves 76 | return TRUE; 77 | } 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Curve.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 curve class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitCurve(); 8 | void R3StopCurve(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Curve : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Curve(void); 18 | virtual ~R3Curve(void); 19 | 20 | // Curve properties 21 | virtual const RNScalar StartParameter(void) const = 0; 22 | virtual const RNScalar EndParameter(void) const = 0; 23 | virtual const R3Point StartPosition(void) const; 24 | virtual const R3Point EndPosition(void) const; 25 | 26 | // Point access 27 | virtual R3Point PointPosition(RNScalar u) const = 0; 28 | virtual R3Vector PointDerivative(RNScalar u) const = 0; 29 | virtual R3Vector PointDirection(RNScalar u) const; 30 | 31 | // Shape property functions/operators 32 | const RNBoolean IsCurve(void) const; 33 | }; 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Draw.h: -------------------------------------------------------------------------------- 1 | /* Include file for R3 draw utility */ 2 | 3 | 4 | 5 | /* Inline macros */ 6 | 7 | #define R3LoadRgb RNLoadRgb 8 | 9 | 10 | 11 | /* Inline functions */ 12 | 13 | inline void 14 | R3LoadNormal(const R3Vector& normal) 15 | { 16 | // Load normal vector 17 | R3LoadNormal(normal.Coords()); 18 | } 19 | 20 | 21 | 22 | inline void 23 | R3LoadPoint(const R3Point& point) 24 | { 25 | // Load vertex 26 | R3LoadPoint(point.Coords()); 27 | } 28 | 29 | 30 | 31 | inline void 32 | R3LoadTextureCoords(const R2Point& texcoords) 33 | { 34 | // Set texture coordinate (within R3BeginXXX and R3EndXXX) 35 | R3LoadTextureCoords(texcoords.Coords()); 36 | } 37 | 38 | 39 | 40 | inline void 41 | R3DrawText(const R3Point& p, const char *str) 42 | { 43 | // Draw text at point 44 | R3DrawText(p.X(), p.Y(), p.Z(), str); 45 | } 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Ray.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS ray class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public variables */ 12 | 13 | const R3Ray R3null_ray(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 14 | const R3Ray R3posx_ray(0.0, 0.0, 0.0, 1.0, 0.0, 0.0); 15 | const R3Ray R3posy_ray(0.0, 0.0, 0.0, 0.0, 1.0, 0.0); 16 | const R3Ray R3posz_ray(0.0, 0.0, 0.0, 0.0, 0.0, 1.0); 17 | const R3Ray R3negx_ray(0.0, 0.0, 0.0, -1.0, 0.0, 0.0); 18 | const R3Ray R3negy_ray(0.0, 0.0, 0.0, 0.0, -1.0, 0.0); 19 | const R3Ray R3negz_ray(0.0, 0.0, 0.0, 0.0, 0.0, -1.0); 20 | 21 | 22 | 23 | /* Public functions */ 24 | 25 | int R3InitRay() 26 | { 27 | /* Return success */ 28 | return TRUE; 29 | } 30 | 31 | 32 | 33 | void R3StopRay() 34 | { 35 | } 36 | 37 | 38 | 39 | R3Ray:: 40 | R3Ray(void) 41 | { 42 | } 43 | 44 | 45 | 46 | R3Ray:: 47 | R3Ray(const R3Ray& ray) 48 | : line(ray.line) 49 | { 50 | } 51 | 52 | 53 | 54 | R3Ray:: 55 | R3Ray(const R3Point& point, const R3Vector& vector, RNBoolean normalized) 56 | : line(point, vector, normalized) 57 | { 58 | } 59 | 60 | 61 | 62 | R3Ray:: 63 | R3Ray(const R3Point& point1, const R3Point& point2) 64 | : line(point1, point2) 65 | { 66 | } 67 | 68 | 69 | 70 | R3Ray:: 71 | R3Ray(RNCoord x1, RNCoord y1, RNCoord z1, RNCoord x2, RNCoord y2, RNCoord z2) 72 | : line(x1, y1, z1, x2, y2, z2) 73 | { 74 | } 75 | 76 | 77 | 78 | const R3Point R3Ray:: 79 | Point(RNScalar t) const 80 | { 81 | // Return point along span 82 | return (Start() + Vector() * t); 83 | } 84 | 85 | 86 | 87 | const RNScalar R3Ray:: 88 | T(const R3Point& point) const 89 | { 90 | // Return parametric value of closest point on ray 91 | if (IsZero()) return 0.0; 92 | RNScalar denom = Vector().Dot(Vector()); 93 | assert(RNIsNotZero(denom)); 94 | R3Vector topoint = point - Start(); 95 | return (Vector().Dot(topoint) / denom); 96 | } 97 | 98 | 99 | 100 | void R3Ray:: 101 | Transform (const R3Transformation& transformation) 102 | { 103 | // Transform line 104 | line.Transform(transformation); 105 | } 106 | 107 | 108 | 109 | void R3Ray:: 110 | InverseTransform (const R3Transformation& transformation) 111 | { 112 | // Transform line 113 | line.InverseTransform(transformation); 114 | } 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Relate.h: -------------------------------------------------------------------------------- 1 | /* Include file for R3 miscelleaneous relationship utility */ 2 | 3 | 4 | 5 | /* Miscellaneous relationship function declarations */ 6 | 7 | R3Point R3Interpolate(const R3Point& point1, const R3Point& point2, RNScalar t1, RNScalar t2, RNScalar t); 8 | 9 | RNAngle R3InteriorAngle(const R3Vector& vector1, const R3Vector& vector2); 10 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Line& line); 11 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Ray& ray); 12 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Span& span); 13 | RNAngle R3InteriorAngle(const R3Vector& vector, const R3Plane& plane); 14 | 15 | RNBoolean R3Abuts(const R3Box& box1, const R3Box& box2); 16 | 17 | int R3Splits(const R3Plane& plane, const R3Span& span); 18 | int R3Splits(const R3Plane& plane, const R3Span& span, R3Span *below_result, R3Span *above_result = NULL); 19 | int R3Splits(const R3Plane& plane, const R3Triangle& triangle); 20 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Shapes.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS shapes module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes.h" 8 | 9 | 10 | 11 | /* Public 3DR variables -- must be set by the application ??? */ 12 | 13 | #if (RN_3D_GRFX == RN_3DR) 14 | R3dHandle_t R3dr_rc = NULL; 15 | G3dHandle_t R3dr_gc = NULL; 16 | #endif 17 | 18 | 19 | 20 | /* Private variables */ 21 | 22 | static int R3shapes_active_count = 0; 23 | 24 | 25 | 26 | int R3InitShapes(void) 27 | { 28 | // Check whether are already initialized 29 | if ((R3shapes_active_count++) > 0) return TRUE; 30 | 31 | // Initialize dependencies 32 | if (!R2InitShapes()) return FALSE; 33 | 34 | // Initialize submodules 35 | if (!R3InitCircle()) return FALSE; 36 | 37 | // return OK status 38 | return TRUE; 39 | } 40 | 41 | 42 | 43 | void R3StopShapes(void) 44 | { 45 | // Check whether have been initialized 46 | if ((--R3shapes_active_count) > 0) return; 47 | 48 | // Stop submodules 49 | R3StopCircle(); 50 | 51 | // Stop dependencies 52 | R2StopShapes(); 53 | } 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Solid.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 solid class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitSolid() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopSolid() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Solid:: 30 | R3Solid(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R3Solid:: 37 | ~R3Solid(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R3Solid:: 44 | IsSolid(void) const 45 | { 46 | // All solid shapes are solids 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Solid.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 solid class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitSolid(); 8 | void R3StopSolid(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Solid : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Solid(void); 18 | ~R3Solid(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSolid(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Surface.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surface class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitSurface() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopSurface() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Surface:: 30 | R3Surface(void) 31 | { 32 | } 33 | 34 | 35 | 36 | R3Surface:: 37 | ~R3Surface(void) 38 | { 39 | } 40 | 41 | 42 | 43 | const RNBoolean R3Surface:: 44 | IsSurface(void) const 45 | { 46 | // All surface shapes are surfaces 47 | return TRUE; 48 | } 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Surface.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 surface class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitSurface(); 8 | void R3StopSurface(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Surface : public R3Shape { 15 | public: 16 | // Constructors/destructors ??? 17 | R3Surface(void); 18 | ~R3Surface(void); 19 | 20 | // Shape property functions/operators 21 | const RNBoolean IsSurface(void) const; 22 | }; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Xform.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 transformation class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Shapes/R3Shapes.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | R3InitTransformation() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | R3StopTransformation() 24 | { 25 | } 26 | 27 | 28 | 29 | R3Transformation:: 30 | ~R3Transformation(void) 31 | { 32 | } 33 | 34 | 35 | 36 | const RNBoolean R3Transformation:: 37 | IsIdentity(void) const 38 | { 39 | // Return whether transformation is identity (default is FALSE) 40 | return FALSE; 41 | } 42 | 43 | 44 | 45 | const RNBoolean R3Transformation:: 46 | IsMirrored(void) const 47 | { 48 | // Return whether transformation is mirrored (default is FALSE) 49 | return FALSE; 50 | } 51 | 52 | 53 | 54 | const RNBoolean R3Transformation:: 55 | IsLinear(void) const 56 | { 57 | // Return whether transformation is linear (default is FALSE) 58 | return FALSE; 59 | } 60 | 61 | 62 | 63 | const RNBoolean R3Transformation:: 64 | IsAffine(void) const 65 | { 66 | // Return whether transformation is affine (default is FALSE) 67 | return FALSE; 68 | } 69 | 70 | 71 | 72 | const RNBoolean R3Transformation:: 73 | IsIsotropic(void) const 74 | { 75 | // Return whether transformation is isotropic (default is FALSE) 76 | return FALSE; 77 | } 78 | 79 | 80 | 81 | const RNScalar R3Transformation:: 82 | ScaleFactor(void) const 83 | { 84 | // Return identity scaling 85 | return 1.0; 86 | } 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Shapes/R3Xform.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 transformation class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int R3InitTransformation(); 8 | void R3StopTransformation(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class R3Transformation /* : public R3Base */ { 15 | public: 16 | // Destructor function 17 | virtual ~R3Transformation(void); 18 | 19 | // Property functions/operators 20 | virtual const RNBoolean IsIdentity(void) const; 21 | virtual const RNBoolean IsMirrored(void) const; 22 | virtual const RNBoolean IsLinear(void) const; 23 | virtual const RNBoolean IsAffine(void) const; 24 | virtual const RNBoolean IsIsotropic(void) const; 25 | 26 | // Application functions/operators 27 | virtual void Apply(R3Vector& vector) const = 0; 28 | virtual void Apply(R3Point& point) const = 0; 29 | virtual void Apply(R3Transformation& transformation) const = 0; 30 | virtual void Apply(R3Affine& affine) const = 0; 31 | virtual void ApplyInverse(R3Vector& vector) const = 0; 32 | virtual void ApplyInverse(R3Point& point) const = 0; 33 | virtual void ApplyInverse(R3Transformation& transformation) const = 0; 34 | virtual void ApplyInverse(R3Affine& affine) const = 0; 35 | virtual void ApplyInverseTranspose(R3Vector& vector) const = 0; 36 | virtual void ApplyTranspose(R3Vector& vector) const = 0; 37 | 38 | // Manipulation functions/operators 39 | virtual void Reset(const R3Transformation& transformation) = 0; 40 | virtual void Transform(const R3Transformation& transformation) = 0; 41 | virtual void InverseTransform(const R3Transformation& transformation) = 0; 42 | 43 | // Draw functions/operators 44 | virtual void Load(void) const = 0; 45 | virtual void Draw(void) const = 0; 46 | virtual void Push(void) const = 0; 47 | virtual void Pop(void) const = 0; 48 | 49 | // Do not use these ??? 50 | virtual const RNScalar ScaleFactor(void) const; 51 | }; 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=R3Surfels 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | R3Surfel.cpp \ 15 | R3SurfelBlock.cpp \ 16 | R3SurfelDatabase.cpp \ 17 | R3SurfelConstraint.cpp \ 18 | R3SurfelPoint.cpp \ 19 | R3SurfelPointSet.cpp \ 20 | R3SurfelPointGraph.cpp \ 21 | R3SurfelNode.cpp \ 22 | R3SurfelNodeSet.cpp \ 23 | R3SurfelTree.cpp \ 24 | R3SurfelScan.cpp \ 25 | R3SurfelFeature.cpp \ 26 | R3SurfelFeatureSet.cpp \ 27 | R3SurfelFeatureVector.cpp \ 28 | R3SurfelFeatureEvaluation.cpp \ 29 | R3SurfelObject.cpp \ 30 | R3SurfelObjectSet.cpp \ 31 | R3SurfelObjectProperty.cpp \ 32 | R3SurfelObjectRelationship.cpp \ 33 | R3SurfelLabel.cpp \ 34 | R3SurfelLabelSet.cpp \ 35 | R3SurfelLabelProperty.cpp \ 36 | R3SurfelLabelRelationship.cpp \ 37 | R3SurfelLabelAssignment.cpp \ 38 | R3SurfelScene.cpp \ 39 | R3SurfelUtils.cpp 40 | 41 | 42 | # 43 | # Dependencies 44 | # 45 | 46 | PKG_DEPENDENCIES = R3Shapes R2Shapes RNBasics 47 | 48 | 49 | 50 | # 51 | # PKG makefile 52 | # 53 | 54 | include ../../makefiles/Makefile.pkgs 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3Surfel.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surfel class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Surfels/R3Surfels.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | R3Surfel:: 14 | R3Surfel(void) 15 | : id(0), 16 | radius(0), 17 | flags(0) 18 | { 19 | // Set everything 20 | this->position[0] = 0; 21 | this->position[1] = 0; 22 | this->position[2] = 0; 23 | this->normal[0] = 0; 24 | this->normal[1] = 0; 25 | this->normal[2] = 0; 26 | this->color[0] = 0; 27 | this->color[1] = 0; 28 | this->color[2] = 0; 29 | } 30 | 31 | 32 | 33 | R3Surfel:: 34 | R3Surfel(float x, float y, float z, 35 | unsigned char r, unsigned char g, unsigned char b, 36 | RNBoolean aerial) 37 | : id(0), 38 | radius(0), 39 | flags(0) 40 | { 41 | // Set everything 42 | this->position[0] = x; 43 | this->position[1] = y; 44 | this->position[2] = z; 45 | this->normal[0] = 0; 46 | this->normal[1] = 0; 47 | this->normal[2] = 0; 48 | this->color[0] = r; 49 | this->color[1] = g; 50 | this->color[2] = b; 51 | SetAerial(aerial); 52 | } 53 | 54 | 55 | 56 | R3Surfel:: 57 | R3Surfel(float x, float y, float z, float nx, float ny, float nz, 58 | float radius, unsigned char r, unsigned char g, unsigned char b, 59 | unsigned char flags) 60 | : id(0), 61 | flags(flags) 62 | { 63 | // Set everything 64 | this->position[0] = x; 65 | this->position[1] = y; 66 | this->position[2] = z; 67 | this->normal[0] = (RNInt16) (32767.0 * nx + 0.5); 68 | this->normal[1] = (RNInt16) (32767.0 * ny + 0.5); 69 | this->normal[2] = (RNInt16) (32767.0 * nz + 0.5); 70 | this->color[0] = r; 71 | this->color[1] = g; 72 | this->color[2] = b; 73 | this->radius = (RNUInt16) (8192.0 * radius + 0.5); 74 | } 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelFeatureEvaluation.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 surfel feature evaluation functions */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // POINTSET FEATURE DEFINITIONS 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | class R3SurfelPointSetFeature : public R3SurfelFeature { 10 | public: 11 | R3SurfelPointSetFeature(const char *name = NULL, RNScalar minimum = -FLT_MAX, RNScalar maximum = FLT_MAX, RNScalar weight = 1); 12 | virtual ~R3SurfelPointSetFeature(void); 13 | virtual int Type(void) const; 14 | virtual int UpdateFeatureVector(R3SurfelObject *object, R3SurfelFeatureVector& vector) const; 15 | }; 16 | 17 | class R3SurfelOverheadGridFeature : public R3SurfelFeature { 18 | public: 19 | R3SurfelOverheadGridFeature(const char *filename, const char *featurename = NULL, RNScalar minimum = -FLT_MAX, RNScalar maximum = FLT_MAX, RNScalar weight = 1); 20 | virtual ~R3SurfelOverheadGridFeature(void); 21 | virtual int Type(void) const; 22 | virtual int UpdateFeatureVector(R3SurfelObject *object, R3SurfelFeatureVector& vector) const; 23 | 24 | public: 25 | char *filename; 26 | R3Matrix world_to_grid_matrix; 27 | int grid_resolution[2]; 28 | FILE *fp; 29 | }; 30 | 31 | 32 | 33 | //////////////////////////////////////////////////////////////////////// 34 | // TOP-LEVEL FUNCTIONS 35 | //////////////////////////////////////////////////////////////////////// 36 | 37 | int CreateFeatures(R3SurfelScene *scene); 38 | int EvaluateFeatures(R3SurfelScene *scene); 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelFeatureSet.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surfel feature set class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // INCLUDE FILES 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | #include "R3Surfels/R3Surfels.h" 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // CONSTRUCTORS/DESTRUCTORS 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | R3SurfelFeatureSet:: 18 | R3SurfelFeatureSet(void) 19 | : features() 20 | { 21 | } 22 | 23 | 24 | 25 | R3SurfelFeatureSet:: 26 | R3SurfelFeatureSet(const R3SurfelFeatureSet& set) 27 | : features() 28 | { 29 | // Not implemented 30 | RNAbort("Not implemented"); 31 | } 32 | 33 | 34 | 35 | R3SurfelFeatureSet:: 36 | ~R3SurfelFeatureSet(void) 37 | { 38 | } 39 | 40 | 41 | 42 | //////////////////////////////////////////////////////////////////////// 43 | // SET MANIPULATION FUNCTIONS 44 | //////////////////////////////////////////////////////////////////////// 45 | 46 | void R3SurfelFeatureSet:: 47 | InsertFeature(R3SurfelFeature *feature) 48 | { 49 | // Insert feature 50 | features.Insert(feature); 51 | } 52 | 53 | 54 | 55 | void R3SurfelFeatureSet:: 56 | RemoveFeature(R3SurfelFeature *feature) 57 | { 58 | // Remove feature 59 | features.Remove(feature); 60 | } 61 | 62 | 63 | 64 | void R3SurfelFeatureSet:: 65 | RemoveFeature(int k) 66 | { 67 | // Remove feature 68 | features.RemoveKth(k); 69 | } 70 | 71 | 72 | 73 | void R3SurfelFeatureSet:: 74 | Empty(void) 75 | { 76 | // Remove features 77 | features.Empty(); 78 | } 79 | 80 | 81 | 82 | //////////////////////////////////////////////////////////////////////// 83 | // DISPLAY FUNCTIONS 84 | //////////////////////////////////////////////////////////////////////// 85 | 86 | void R3SurfelFeatureSet:: 87 | Print(FILE *fp, const char *prefix, const char *suffix) const 88 | { 89 | // Check fp 90 | if (!fp) fp = stdout; 91 | 92 | // Print features 93 | // Print all surfel features 94 | if (prefix) fprintf(fp, "%s", prefix); 95 | for (int i = 0; i < NFeatures(); i++) { 96 | R3SurfelFeature *feature = Feature(i); 97 | fprintf(fp, "%s ", feature->Name()); 98 | } 99 | if (suffix) fprintf(fp, "%s", suffix); 100 | fprintf(fp, "\n"); 101 | } 102 | 103 | 104 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelFeatureSet.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 surfel feature set class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // CLASS DEFINITION 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | class R3SurfelFeatureSet { 10 | public: 11 | ////////////////////////////////////////// 12 | //// CONSTRUCTOR/DESTRUCTOR FUNCTIONS //// 13 | ////////////////////////////////////////// 14 | 15 | // Constructor functions 16 | R3SurfelFeatureSet(void); 17 | R3SurfelFeatureSet(const R3SurfelFeatureSet& set); 18 | 19 | // Destructor function 20 | virtual ~R3SurfelFeatureSet(void); 21 | 22 | 23 | ////////////////////////// 24 | //// ACCESS FUNCTIONS //// 25 | ////////////////////////// 26 | 27 | // Feature access functions 28 | int NFeatures(void) const; 29 | R3SurfelFeature *Feature(int k) const; 30 | R3SurfelFeature *operator[](int k) const; 31 | 32 | 33 | ///////////////////////////////////////// 34 | //// MANIPULATION FUNCTIONS //// 35 | ///////////////////////////////////////// 36 | 37 | // Function insertion/removal functions 38 | virtual void InsertFeature(R3SurfelFeature *feature); 39 | virtual void RemoveFeature(R3SurfelFeature *feature); 40 | virtual void RemoveFeature(int k); 41 | virtual void Empty(void); 42 | 43 | 44 | /////////////////////////// 45 | //// DISPLAY FUNCTIONS //// 46 | /////////////////////////// 47 | 48 | // Print function 49 | virtual void Print(FILE *fp = NULL, const char *prefix = NULL, const char *suffix = NULL) const; 50 | 51 | 52 | //////////////////////////////////////////////////////////////////////// 53 | // INTERNAL STUFF BELOW HERE 54 | //////////////////////////////////////////////////////////////////////// 55 | 56 | private: 57 | RNArray features; 58 | }; 59 | 60 | 61 | 62 | //////////////////////////////////////////////////////////////////////// 63 | // INLINE FUNCTION DEFINITIONS 64 | //////////////////////////////////////////////////////////////////////// 65 | 66 | inline int R3SurfelFeatureSet:: 67 | NFeatures(void) const 68 | { 69 | // Return number of features 70 | return features.NEntries(); 71 | } 72 | 73 | 74 | 75 | inline R3SurfelFeature *R3SurfelFeatureSet:: 76 | Feature(int k) const 77 | { 78 | // Return kth feature 79 | return features.Kth(k); 80 | } 81 | 82 | 83 | 84 | inline R3SurfelFeature *R3SurfelFeatureSet:: 85 | operator[](int k) const 86 | { 87 | // Return kth feature 88 | return Feature(k); 89 | } 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelLabelAssignment.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 label assignment class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // INCLUDE FILES 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | #include "R3Surfels/R3Surfels.h" 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // CONSTRUCTORS/DESTRUCTORS 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | R3SurfelLabelAssignment:: 18 | R3SurfelLabelAssignment(R3SurfelObject *object, R3SurfelLabel* label, RNScalar confidence, int originator) 19 | : scene(NULL), 20 | scene_index(-1), 21 | object(object), 22 | object_index(-1), 23 | label(label), 24 | label_index(-1), 25 | confidence(confidence), 26 | originator(originator), 27 | data(NULL) 28 | { 29 | } 30 | 31 | 32 | 33 | R3SurfelLabelAssignment:: 34 | R3SurfelLabelAssignment(const R3SurfelLabelAssignment& assignment) 35 | : scene(NULL), 36 | scene_index(-1), 37 | object(assignment.object), 38 | object_index(-1), 39 | label(assignment.label), 40 | label_index(-1), 41 | confidence(assignment.confidence), 42 | originator(assignment.originator), 43 | data(NULL) 44 | { 45 | } 46 | 47 | 48 | 49 | R3SurfelLabelAssignment:: 50 | ~R3SurfelLabelAssignment(void) 51 | { 52 | // Update scene 53 | if (scene) scene->RemoveLabelAssignment(this); 54 | } 55 | 56 | 57 | 58 | //////////////////////////////////////////////////////////////////////// 59 | // PROPERTY MANIPULATION FUNCTIONS 60 | //////////////////////////////////////////////////////////////////////// 61 | 62 | void R3SurfelLabelAssignment:: 63 | SetConfidence(RNScalar confidence) 64 | { 65 | // Set confidence 66 | this->confidence = confidence; 67 | 68 | // Mark scene as dirty 69 | if (scene) scene->SetDirty(); 70 | } 71 | 72 | 73 | 74 | void R3SurfelLabelAssignment:: 75 | SetOriginator(int originator) 76 | { 77 | // Set originator 78 | this->originator = originator; 79 | 80 | // Mark scene as dirty 81 | if (scene) scene->SetDirty(); 82 | } 83 | 84 | 85 | 86 | void R3SurfelLabelAssignment:: 87 | SetData(void *data) 88 | { 89 | // Set user data 90 | this->data = data; 91 | } 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelLabelProperty.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surfel label property class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // INCLUDE FILES 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | #include "R3Surfels/R3Surfels.h" 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // CONSTRUCTORS/DESTRUCTORS 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | R3SurfelLabelProperty:: 18 | R3SurfelLabelProperty(int type, R3SurfelLabel *label, RNScalar *operands, int noperands) 19 | : scene(NULL), 20 | scene_index(-1), 21 | label(label), 22 | operands(NULL), 23 | noperands(0), 24 | type(type) 25 | { 26 | // Check if operands were provided 27 | if ((noperands > 0) && (operands)) { 28 | // Copy operands 29 | this->noperands = noperands; 30 | this->operands = new RNScalar [ this->noperands ]; 31 | for (int i = 0; i < this->noperands; i++) { 32 | this->operands[i] = operands[i]; 33 | } 34 | } 35 | } 36 | 37 | 38 | 39 | R3SurfelLabelProperty:: 40 | R3SurfelLabelProperty(const R3SurfelLabelProperty& property) 41 | : scene(NULL), 42 | scene_index(-1), 43 | label(property.label), 44 | operands(NULL), 45 | noperands(0), 46 | type(property.type) 47 | { 48 | // Copy operands 49 | if ((property.noperands > 0) && (property.operands)) { 50 | this->noperands = property.noperands; 51 | this->operands = new RNScalar [ this->noperands ]; 52 | for (int i = 0; i < this->noperands; i++) { 53 | this->operands[i] = property.operands[i]; 54 | } 55 | } 56 | } 57 | 58 | 59 | 60 | R3SurfelLabelProperty:: 61 | ~R3SurfelLabelProperty(void) 62 | { 63 | // Remove from scene 64 | if (scene) scene->RemoveLabelProperty(this); 65 | 66 | // Delete operands 67 | if (operands) delete [] operands; 68 | } 69 | 70 | 71 | 72 | 73 | 74 | 75 | //////////////////////////////////////////////////////////////////////// 76 | // INTERNAL FUNCDTIONS 77 | //////////////////////////////////////////////////////////////////////// 78 | 79 | int R3SurfelLabelProperty:: 80 | NOperands(int type) 81 | { 82 | // Return number of operands 83 | switch (type) { 84 | } 85 | 86 | // Default case 87 | return 0; 88 | } 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelLabelSet.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the R3 surfel label set class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // INCLUDE FILES 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | #include "R3Surfels/R3Surfels.h" 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // CONSTRUCTORS/DESTRUCTORS 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | R3SurfelLabelSet:: 18 | R3SurfelLabelSet(void) 19 | : labels() 20 | { 21 | } 22 | 23 | 24 | 25 | R3SurfelLabelSet:: 26 | R3SurfelLabelSet(const R3SurfelLabelSet& set) 27 | : labels() 28 | { 29 | // Not implemented 30 | RNAbort("Not implemented"); 31 | } 32 | 33 | 34 | 35 | R3SurfelLabelSet:: 36 | ~R3SurfelLabelSet(void) 37 | { 38 | } 39 | 40 | 41 | 42 | //////////////////////////////////////////////////////////////////////// 43 | // SET MANIPULATION FUNCTIONS 44 | //////////////////////////////////////////////////////////////////////// 45 | 46 | void R3SurfelLabelSet:: 47 | InsertLabel(R3SurfelLabel *label) 48 | { 49 | // Insert label 50 | labels.Insert(label); 51 | } 52 | 53 | 54 | 55 | void R3SurfelLabelSet:: 56 | RemoveLabel(R3SurfelLabel *label) 57 | { 58 | // Remove label 59 | labels.Remove(label); 60 | } 61 | 62 | 63 | 64 | void R3SurfelLabelSet:: 65 | RemoveLabel(int k) 66 | { 67 | // Remove label 68 | labels.RemoveKth(k); 69 | } 70 | 71 | 72 | 73 | void R3SurfelLabelSet:: 74 | Empty(void) 75 | { 76 | // Remove labels 77 | labels.Empty(); 78 | } 79 | 80 | 81 | 82 | //////////////////////////////////////////////////////////////////////// 83 | // DISPLAY FUNCTIONS 84 | //////////////////////////////////////////////////////////////////////// 85 | 86 | void R3SurfelLabelSet:: 87 | Print(FILE *fp, const char *prefix, const char *suffix) const 88 | { 89 | // Check fp 90 | if (!fp) fp = stdout; 91 | 92 | // Print labels 93 | // Print all surfel labels 94 | if (prefix) fprintf(fp, "%s", prefix); 95 | for (int i = 0; i < NLabels(); i++) { 96 | R3SurfelLabel *label = Label(i); 97 | fprintf(fp, "%s ", label->Name()); 98 | } 99 | if (suffix) fprintf(fp, "%s", suffix); 100 | fprintf(fp, "\n"); 101 | } 102 | 103 | 104 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3SurfelLabelSet.h: -------------------------------------------------------------------------------- 1 | /* Include file for the R3 surfel label set class */ 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // CLASS DEFINITION 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | class R3SurfelLabelSet { 10 | public: 11 | ////////////////////////////////////////// 12 | //// CONSTRUCTOR/DESTRUCTOR FUNCTIONS //// 13 | ////////////////////////////////////////// 14 | 15 | // Constructor functions 16 | R3SurfelLabelSet(void); 17 | R3SurfelLabelSet(const R3SurfelLabelSet& set); 18 | 19 | // Destructor function 20 | virtual ~R3SurfelLabelSet(void); 21 | 22 | 23 | ////////////////////////// 24 | //// ACCESS FUNCTIONS //// 25 | ////////////////////////// 26 | 27 | // Label access functions 28 | int NLabels(void) const; 29 | R3SurfelLabel *Label(int k) const; 30 | R3SurfelLabel *operator[](int k) const; 31 | 32 | 33 | ///////////////////////////////////////// 34 | //// MANIPULATION FUNCTIONS //// 35 | ///////////////////////////////////////// 36 | 37 | // Function insertion/removal functions 38 | virtual void InsertLabel(R3SurfelLabel *label); 39 | virtual void RemoveLabel(R3SurfelLabel *label); 40 | virtual void RemoveLabel(int k); 41 | virtual void Empty(void); 42 | 43 | 44 | /////////////////////////// 45 | //// DISPLAY FUNCTIONS //// 46 | /////////////////////////// 47 | 48 | // Print function 49 | virtual void Print(FILE *fp = NULL, const char *prefix = NULL, const char *suffix = NULL) const; 50 | 51 | 52 | //////////////////////////////////////////////////////////////////////// 53 | // INTERNAL STUFF BELOW HERE 54 | //////////////////////////////////////////////////////////////////////// 55 | 56 | private: 57 | RNArray labels; 58 | }; 59 | 60 | 61 | 62 | //////////////////////////////////////////////////////////////////////// 63 | // INLINE FUNCTION DEFINITIONS 64 | //////////////////////////////////////////////////////////////////////// 65 | 66 | inline int R3SurfelLabelSet:: 67 | NLabels(void) const 68 | { 69 | // Return number of labels 70 | return labels.NEntries(); 71 | } 72 | 73 | 74 | 75 | inline R3SurfelLabel *R3SurfelLabelSet:: 76 | Label(int k) const 77 | { 78 | // Return kth label 79 | return labels.Kth(k); 80 | } 81 | 82 | 83 | 84 | inline R3SurfelLabel *R3SurfelLabelSet:: 85 | operator[](int k) const 86 | { 87 | // Return kth label 88 | return Label(k); 89 | } 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /gaps/pkgs/R3Surfels/R3Surfels.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS surfels module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "R3Surfels.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int R3surfels_active_count = 0; 14 | 15 | 16 | 17 | int R3InitSurfels(void) 18 | { 19 | // Check whether are already initialized 20 | if ((R3surfels_active_count++) > 0) return TRUE; 21 | 22 | // Initialize dependencies 23 | if (!R3InitShapes()) return FALSE; 24 | 25 | // return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void R3StopSurfels(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--R3surfels_active_count) > 0) return; 35 | 36 | // Stop dependencies 37 | R3StopShapes(); 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=RNBasics 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | RNTime.cpp \ 15 | RNGrfx.cpp RNRgb.cpp \ 16 | RNMap.cpp RNHeap.cpp RNQueue.cpp RNArray.cpp \ 17 | RNSvd.cpp RNIntval.cpp RNScalar.cpp \ 18 | RNType.cpp \ 19 | RNFlags.cpp \ 20 | RNFile.cpp RNMem.cpp \ 21 | RNError.cpp \ 22 | RNBase.cpp 23 | 24 | 25 | 26 | # 27 | # PKG makefile 28 | # 29 | 30 | include ../../makefiles/Makefile.pkgs 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBase.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS base class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Global variables */ 12 | 13 | RNMark RNmark = 1; 14 | 15 | 16 | 17 | int RNInitBase() 18 | { 19 | /* Return OK status */ 20 | return TRUE; 21 | } 22 | 23 | 24 | 25 | void RNStopBase() 26 | { 27 | } 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBase.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS basics */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitBase(); 8 | void RNStopBase(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class RNBase {}; 15 | 16 | 17 | 18 | /* TRUE/FALSE constant definitions */ 19 | 20 | typedef int RNBoolean; 21 | #ifndef TRUE 22 | #define TRUE 1 23 | #endif 24 | #ifndef FALSE 25 | #define FALSE 0 26 | #endif 27 | 28 | 29 | 30 | /* Programming convenience macros */ 31 | 32 | #define brcase break; case 33 | 34 | 35 | 36 | /* Standard types */ 37 | 38 | typedef int RNMark; 39 | 40 | 41 | 42 | /* Global variables */ 43 | 44 | extern RNMark RNmark; 45 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBasics.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS basics module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int RNbasics_active_count = 0; 14 | 15 | 16 | 17 | int RNInitBasics(void) 18 | { 19 | // Check whether are already initialized 20 | if ((RNbasics_active_count++) > 0) return TRUE; 21 | 22 | // Initialize submodules 23 | RNSeedRandomScalar(); 24 | 25 | // Return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void RNStopBasics(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--RNbasics_active_count) > 0) return; 35 | 36 | // Stop submodules 37 | // ??? 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNBasics.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS basics module */ 2 | 3 | #ifndef __RN__BASICS__H__ 4 | #define __RN__BASICS__H__ 5 | 6 | 7 | 8 | /* Compatability switch include files */ 9 | 10 | #include "RNCompat.h" 11 | 12 | 13 | 14 | /* External include files */ 15 | 16 | #include "RNExtern.h" 17 | 18 | 19 | 20 | /* Base class for GAPS modules */ 21 | 22 | #include "RNBase.h" 23 | 24 | 25 | 26 | /* Error reporting include files */ 27 | 28 | #include "RNError.h" 29 | 30 | 31 | 32 | /* Memory management include files */ 33 | 34 | #include "RNMem.h" 35 | 36 | 37 | 38 | /* File management include files */ 39 | 40 | #include "RNFile.h" 41 | 42 | 43 | 44 | /* Basic bitflags include files */ 45 | 46 | #include "RNFlags.h" 47 | 48 | 49 | 50 | /* Class type include files */ 51 | 52 | #include "RNType.h" 53 | 54 | 55 | 56 | /* Math include files */ 57 | 58 | #include "RNScalar.h" 59 | #include "RNIntval.h" 60 | 61 | 62 | 63 | /* Dynamic array include files */ 64 | 65 | #include "RNArray.h" 66 | #include "RNQueue.h" 67 | #include "RNHeap.h" 68 | #include "RNMap.h" 69 | 70 | 71 | 72 | /* Graphics utility include files */ 73 | 74 | #include "RNGrfx.h" 75 | #include "RNRgb.h" 76 | 77 | 78 | 79 | /* OS utility include files */ 80 | 81 | #include "RNTime.h" 82 | 83 | 84 | 85 | /* SVD stuff */ 86 | 87 | #include "RNSvd.h" 88 | 89 | 90 | 91 | /* Initialization functions */ 92 | 93 | int RNInitBasics(void); 94 | void RNStopBasics(void); 95 | 96 | 97 | 98 | #endif 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNError.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS error utility */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitError(); 8 | void RNStopError(); 9 | 10 | 11 | 12 | /* Error file functions */ 13 | 14 | void RNSetErrorFile(FILE *fp); 15 | void RNSetErrorLevel(int level); 16 | 17 | 18 | 19 | /* Error reporting functions */ 20 | 21 | void RNAbort(const char *fmt, ...); 22 | void RNFail(const char *fmt, ...); 23 | void RNWarning(const char *fmt, ...); 24 | 25 | 26 | 27 | /* Define my own assert function */ 28 | 29 | #ifdef assert 30 | # undef assert 31 | #endif 32 | 33 | #ifdef NDEBUG 34 | #define assert(__x__) 35 | #else 36 | #define assert(__x__) \ 37 | if (!(__x__)) RNAbort("Assertion error %s at line %d in file %s", #__x__, __LINE__, __FILE__) 38 | #endif 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNExtern.h: -------------------------------------------------------------------------------- 1 | /* Include file for external stuff */ 2 | 3 | 4 | 5 | /* Usual C include files */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | 18 | /* Standard library include files */ 19 | 20 | #include 21 | #include 22 | 23 | 24 | 25 | /* Machine dependent include files */ 26 | 27 | #if (RN_OS == RN_WINDOWS) 28 | # include 29 | # include 30 | #else 31 | # include 32 | # include 33 | # include 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFile.cpp: -------------------------------------------------------------------------------- 1 | // Source file for file management utilities 2 | 3 | 4 | // Include files 5 | #include "RNBasics.h" 6 | 7 | 8 | 9 | //////////////////////////////////////////////////////////////////////// 10 | // FILE EXISTANCE FUNCTIONS 11 | //////////////////////////////////////////////////////////////////////// 12 | 13 | RNBoolean 14 | RNFileExists(const char *filename) 15 | { 16 | // Return whether or not file exists (and is readable) 17 | FILE *fp = fopen(filename, "rb"); 18 | if (!fp) return FALSE; 19 | fclose(fp); 20 | return TRUE; 21 | } 22 | 23 | 24 | 25 | //////////////////////////////////////////////////////////////////////// 26 | // FILE I/O UTILITY FUNCTIONS 27 | //////////////////////////////////////////////////////////////////////// 28 | 29 | int 30 | RNFileSeek(FILE *fp, unsigned long long offset, int whence) 31 | { 32 | #if (RN_OS == RN_WINDOWS) 33 | if (_fseeki64(fp, offset, whence) == 0) return 1; 34 | else return 0; 35 | #else 36 | // Linux/unix/cygwin etc. 37 | if (fseeko(fp, offset, whence) == 0) return 1; 38 | else return 0; 39 | #endif 40 | } 41 | 42 | 43 | 44 | unsigned long long 45 | RNFileTell(FILE *fp) 46 | { 47 | #if (RN_OS == RN_WINDOWS) 48 | return _ftelli64(fp); 49 | #else 50 | // Linux/unix/cygwin etc. 51 | return ftello(fp); 52 | #endif 53 | } 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFile.h: -------------------------------------------------------------------------------- 1 | // Include file for file management utilities 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // File existance funcitons 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | RNBoolean RNFileExists(const char *filename); 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // File seek funcitons 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | int RNFileSeek(FILE *fp, unsigned long long offset, int whence); 18 | unsigned long long RNFileTell(FILE *fp); 19 | 20 | 21 | 22 | //////////////////////////////////////////////////////////////////////// 23 | // File seek constants 24 | //////////////////////////////////////////////////////////////////////// 25 | 26 | #define RN_FILE_SEEK_SET SEEK_SET 27 | #define RN_FILE_SEEK_CUR SEEK_CUR 28 | #define RN_FILE_SEEK_END SEEK_END 29 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFlags.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS flags class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | RNInitFlags() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | RNStopFlags() 24 | { 25 | } 26 | 27 | 28 | 29 | RNFlags:: 30 | RNFlags(void) 31 | : flags(0) 32 | { 33 | } 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNFlags.h: -------------------------------------------------------------------------------- 1 | /* Include file for the GAPS flags class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitFlags(); 8 | void RNStopFlags(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class RNFlags /* : public RNBase */ { 15 | public: 16 | // Constructor functions 17 | RNFlags(void); 18 | RNFlags(unsigned long flags); 19 | 20 | // Type conversions 21 | operator unsigned long(void) const; 22 | 23 | // Relationship functions/operators 24 | int Intersects(const RNFlags flags) const; 25 | int Contains(const RNFlags flags) const; 26 | int operator[](const RNFlags flags) const; 27 | 28 | // Manipulation functions/operators 29 | void Add(const RNFlags flags); 30 | void Remove(const RNFlags flags); 31 | void Intersect(const RNFlags flags); 32 | void Reset(unsigned long flags); 33 | 34 | private: 35 | unsigned long flags; 36 | }; 37 | 38 | 39 | 40 | /* Flag mask definitions */ 41 | 42 | #define RN_NO_FLAGS 0x00000000 43 | #define RN_NULL_FLAGS 0x00000000 44 | #define RN_ALL_FLAGS 0xFFFFFFFF 45 | 46 | 47 | 48 | /* Inline functions */ 49 | 50 | inline RNFlags:: 51 | RNFlags(unsigned long flags) 52 | : flags(flags) 53 | { 54 | } 55 | 56 | 57 | 58 | inline RNFlags::operator 59 | unsigned long(void) const 60 | { 61 | // Convert RNFlags to unsigned long 62 | return flags; 63 | } 64 | 65 | 66 | 67 | inline int RNFlags:: 68 | Intersects(const RNFlags flags) const 69 | { 70 | // Return whether has a property 71 | return (this->flags & flags) ? 1 : 0; 72 | } 73 | 74 | 75 | 76 | inline int RNFlags:: 77 | Contains(const RNFlags flags) const 78 | { 79 | // Return whether contains all properties 80 | return ((this->flags & flags) == flags); 81 | } 82 | 83 | 84 | 85 | inline int RNFlags:: 86 | operator[] (const RNFlags flags) const 87 | { 88 | // Return whether flags intersect 89 | return this->Intersects(flags); 90 | } 91 | 92 | 93 | 94 | inline void RNFlags:: 95 | Add(const RNFlags flags) 96 | { 97 | // Union this set of flags with ones passed in 98 | this->flags |= flags; 99 | } 100 | 101 | 102 | 103 | inline void RNFlags:: 104 | Remove(const RNFlags flags) 105 | { 106 | // Diff this set of flags with ones passed in 107 | this->flags &= ~flags; 108 | } 109 | 110 | 111 | 112 | inline void RNFlags:: 113 | Intersect(const RNFlags flags) 114 | { 115 | // Intersect this set of flags with ones passed in 116 | this->flags &= flags; 117 | } 118 | 119 | 120 | 121 | inline void RNFlags:: 122 | Reset(unsigned long flags) 123 | { 124 | // Set flags 125 | this->flags = flags; 126 | } 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNHeap.h: -------------------------------------------------------------------------------- 1 | // Include file for a heap 2 | 3 | #ifndef __RN__HEAP__H__ 4 | #define __RN__HEAP__H__ 5 | 6 | 7 | 8 | // Class definition 9 | 10 | template 11 | class RNHeap { 12 | public: 13 | // Constructor functions 14 | RNHeap(RNScalar (*value_callback)(PtrType, void *), 15 | PtrType **(*entry_callback)(PtrType, void *) = NULL, 16 | void *callback_data = NULL, int least_first = TRUE); 17 | RNHeap(PtrType base, RNScalar *value_ptr, PtrType **entry_ptr = NULL, int least_first = TRUE); 18 | RNHeap(int value_offset, int entry_offset = -1, int least_first = TRUE); 19 | ~RNHeap(void); 20 | 21 | // Data access functions 22 | int IsEmpty(void) const; 23 | int NEntries(void) const; 24 | PtrType Kth(int k) const; 25 | PtrType operator[](int k) const; 26 | PtrType Peek(void) const; 27 | 28 | // Manipulation functions 29 | void Empty(void); 30 | void Sort(int n = -1); 31 | void Truncate(int n, RNBoolean sort = TRUE); 32 | void Remove(PtrType data); 33 | void Update(PtrType data); 34 | void Push(PtrType data); 35 | PtrType Pop(void); 36 | 37 | // Debug functions 38 | int IsValid(void); 39 | 40 | protected: 41 | // Update functions 42 | RNScalar Value(int i) const; 43 | int Compare(int i, int j) const; 44 | void Swap(int i, int j); 45 | void Sort(int n, int left, int right); 46 | int BubbleUp(int i); 47 | int BubbleDown(int i); 48 | 49 | private: 50 | PtrType *entries; 51 | int nentries; 52 | int nallocated; 53 | int value_offset; 54 | int entry_offset; 55 | RNScalar (*value_callback)(PtrType, void *); 56 | PtrType **(*entry_callback)(PtrType, void *); 57 | void *callback_data; 58 | int least_first; 59 | }; 60 | 61 | 62 | 63 | // Include files 64 | 65 | #include "RNHeap.cpp" 66 | 67 | 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNMap.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for the GAPS map class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Public functions */ 12 | 13 | int 14 | RNInitMap() 15 | { 16 | /* Return success */ 17 | return TRUE; 18 | } 19 | 20 | 21 | 22 | void 23 | RNStopMap() 24 | { 25 | } 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNMap.h: -------------------------------------------------------------------------------- 1 | /* Include file for the GAPS map class */ 2 | 3 | #ifndef __RN__MAP__H__ 4 | #define __RN__MAP__H__ 5 | 6 | 7 | 8 | /* Library initialization functions */ 9 | 10 | int RNInitMap(); 11 | void RNStopMap(); 12 | 13 | 14 | 15 | /* Support class */ 16 | 17 | template 18 | struct RNMapComparator { 19 | public: 20 | RNMapComparator(int (*compare_function)(KeyType, KeyType) = NULL) : compare_function(compare_function) {}; 21 | bool operator()(KeyType a, KeyType b) const { 22 | if (compare_function) { return ((*compare_function)(a, b) < 0) ? true: false; } 23 | else { return a < b; } 24 | }; 25 | private: 26 | int (*compare_function)(KeyType, KeyType); 27 | }; 28 | 29 | 30 | 31 | /* Class definition */ 32 | 33 | template 34 | class RNMap { 35 | public: 36 | // Constructor/destructor functions 37 | RNMap(void); 38 | RNMap(int (*compare)(KeyType, KeyType)); 39 | RNMap(const RNMap& map); 40 | ~RNMap(void); 41 | 42 | // Property functions/operations 43 | int NEntries(void) const; 44 | 45 | // Data access functions/operators 46 | RNBoolean Find(KeyType key, ValueType *value = NULL) const; 47 | 48 | // Manipulation functions 49 | void Empty(void); 50 | void Insert(KeyType key, ValueType value); 51 | void Replace(KeyType key, ValueType value); 52 | void Remove(KeyType key); 53 | 54 | // Manipulation operators 55 | RNMap& operator=(const RNMap& map); 56 | 57 | private: 58 | std::map > *m; 59 | }; 60 | 61 | 62 | 63 | 64 | /* Templated member functions */ 65 | 66 | #include "RNMap.I" 67 | 68 | 69 | 70 | /* A useful derived class definition */ 71 | 72 | template 73 | class RNSymbolTable : public RNMap { 74 | public: 75 | // Constructor/destructor functions 76 | RNSymbolTable(void) : RNMap() {}; 77 | }; 78 | 79 | 80 | 81 | #endif 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNMem.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS mem utility */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitMem(); 8 | void RNStopMem(); 9 | 10 | 11 | 12 | /* Memory allocation/deallocation functions */ 13 | 14 | #if FALSE 15 | 16 | void *operator new(size_t size); 17 | void *operator new(size_t size, size_t extra); 18 | void operator delete(void *data); 19 | 20 | #endif 21 | 22 | 23 | 24 | /* Standard memory manipulation functions */ 25 | 26 | #define RN_SWAP_BUFFER_SIZE 1024 27 | void RNSwap(void *node1, void *node2, void *buffer, int size); 28 | void RNCopy(const void *src, void *dst, int size); 29 | void RNZero(void *data, int size); 30 | int RNCompare(const void *src1, const void *src2, int size); 31 | 32 | 33 | 34 | /* Memory usage statistics */ 35 | 36 | long RNMaxMemoryUsage(void); 37 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNSvd.h: -------------------------------------------------------------------------------- 1 | // Include file for SVD functions 2 | 3 | 4 | 5 | // Function to perform singular value decomposition 6 | 7 | extern void RNSvdDecompose(int m, int n, 8 | const RNScalar *a, 9 | RNScalar *u, RNScalar *w, RNScalar *vt); 10 | 11 | 12 | 13 | // Function to perform back substitution 14 | 15 | extern void RNSvdBacksubstitute(int m, int n, 16 | const RNScalar *u, const RNScalar *w, const RNScalar *vt, const RNScalar *b, 17 | RNScalar *x, RNScalar eps = RN_EPSILON); 18 | 19 | 20 | 21 | // Function to solve system of equations by SVD and back substitution 22 | 23 | extern void RNSvdSolve(int m, int n, 24 | const RNScalar *a, const RNScalar *b, 25 | RNScalar *x, RNScalar eps = RN_EPSILON); 26 | 27 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNTime.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS real wallclock time class */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | int RNInitTime() 12 | { 13 | /* Return OK status */ 14 | return TRUE; 15 | } 16 | 17 | 18 | 19 | void RNStopTime() 20 | { 21 | } 22 | 23 | 24 | 25 | RNTime:: 26 | RNTime(void) 27 | { 28 | # if (RN_OS == RN_WINDOWS) 29 | QueryPerformanceFrequency(&timefreq); 30 | # endif 31 | } 32 | 33 | 34 | 35 | RNTime:: 36 | RNTime(const RNTime& tm) 37 | : timevalue(tm.timevalue) 38 | { 39 | # if (RN_OS == RN_WINDOWS) 40 | timefreq = timefreq; 41 | # endif 42 | } 43 | 44 | 45 | 46 | RNScalar RNTime:: 47 | operator- (const RNTime& tm) const 48 | { 49 | /* Return the difference between this and tm times (in seconds) */ 50 | # if (RN_OS == RN_WINDOWS) 51 | return ((RNScalar) this->timevalue.QuadPart - (RNScalar) tm.timevalue.QuadPart) / ((RNScalar) this->timefreq.QuadPart); 52 | # elif (RN_OS == OLD_RN_WINDOWS) 53 | return (RNScalar) (this->timevalue - tm.timevalue) / 1.0E3; 54 | # else 55 | return (RNScalar) (this->timevalue.tv_sec - tm.timevalue.tv_sec + 56 | 1.0E-6F * (this->timevalue.tv_usec - tm.timevalue.tv_usec)); 57 | # endif 58 | } 59 | 60 | 61 | 62 | RNScalar RNTime:: 63 | Elapsed (const RNTime& tm) const 64 | { 65 | // Return number of seconds elapsed between times 66 | RNScalar delta = *this - tm; 67 | assert(delta >= 0.0); 68 | return delta; 69 | } 70 | 71 | 72 | 73 | RNScalar RNTime:: 74 | Elapsed (void) const 75 | { 76 | // Return number of seconds elapsed since time 77 | RNTime tm; tm.Read(); 78 | return tm.Elapsed(*this); 79 | } 80 | 81 | 82 | 83 | RNTime 84 | RNCurrentTime(void) 85 | { 86 | RNTime tm; 87 | tm.Read(); 88 | return tm; 89 | } 90 | 91 | 92 | 93 | 94 | #if (RN_OS != RN_WINDOWS) 95 | # include 96 | #endif 97 | 98 | void 99 | RNSleep(RNScalar seconds) 100 | { 101 | #if (RN_OS == RN_IRIX) 102 | sginap((long) (seconds * CLK_TCK)); 103 | #elif (RN_OS == RN_WINDOWS) 104 | Sleep((unsigned long) (1000 * seconds)); 105 | #elif (RN_OS == RN_LINUX) 106 | usleep((unsigned long) (1000000 * seconds)); 107 | #else 108 | RNAbort("Not implemented"); 109 | #endif 110 | } 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNTime.h: -------------------------------------------------------------------------------- 1 | /* Include file for GAPS wallclock time class */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitTime(); 8 | void RNStopTime(); 9 | 10 | 11 | 12 | /* Class definition */ 13 | 14 | class RNTime /* : public RNBase */ { 15 | public: 16 | // Constructor functions 17 | RNTime(void); 18 | RNTime(const RNTime& tm); 19 | 20 | // Relationship functions/operators 21 | RNScalar Elapsed(const RNTime& tm) const; 22 | RNScalar Elapsed(void) const; 23 | 24 | // Arithmetic operators 25 | RNScalar operator-(const RNTime& tm) const; 26 | 27 | // Manipulation functions/operators 28 | void Read(void); 29 | 30 | private: 31 | # if (RN_OS == RN_WINDOWS) 32 | LARGE_INTEGER timefreq; 33 | LARGE_INTEGER timevalue; 34 | # elif (RN_OS == OLD_RN_WINDOWS) 35 | DWORD timevalue; 36 | # else 37 | struct timeval timevalue; 38 | # endif 39 | }; 40 | 41 | 42 | 43 | /* Public functions */ 44 | 45 | RNTime RNCurrentTime(void); 46 | void RNSleep(RNScalar seconds); 47 | 48 | 49 | 50 | /* Inline functions */ 51 | 52 | inline void RNTime:: 53 | Read (void) 54 | { 55 | /* Read the current time */ 56 | # if (RN_OS == RN_WINDOWS) 57 | QueryPerformanceCounter(&timevalue); 58 | # elif (RN_OS == OLD_RN_WINDOWS) 59 | timevalue = GetTickCount(); 60 | # else 61 | gettimeofday(&timevalue, NULL); 62 | # endif 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNType.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS class types */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNBasics.h" 8 | 9 | 10 | 11 | /* Public variables */ 12 | 13 | const RNClassType RNnull_class_type(RN_NULL_CLASS_ID, ""); 14 | 15 | 16 | 17 | /* Private variables */ 18 | 19 | static RNClassID RNnclass_ids = 0; 20 | 21 | 22 | 23 | int RNInitClassType() 24 | { 25 | /* Return OK status */ 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void RNStopClassType() 32 | { 33 | } 34 | 35 | 36 | 37 | RNClassType:: 38 | RNClassType(RNClassID id, const char *name) 39 | { 40 | // Initialize class type 41 | this->id = id; 42 | if (!name) this->name = NULL; 43 | else { 44 | this->name = new char[strlen(name) + 1]; 45 | assert(this->name); 46 | strcpy(this->name, name); 47 | } 48 | } 49 | 50 | 51 | 52 | RNClassType:: 53 | RNClassType(const char *name) 54 | { 55 | // Initialize class type 56 | id = ++RNnclass_ids; 57 | if (!name) this->name = NULL; 58 | else { 59 | this->name = new char[strlen(name) + 1]; 60 | assert(this->name); 61 | strcpy(this->name, name); 62 | } 63 | } 64 | 65 | 66 | 67 | RNClassType:: 68 | ~RNClassType(void) 69 | { 70 | // Free name 71 | if (name) delete [] name; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /gaps/pkgs/RNBasics/RNType.h: -------------------------------------------------------------------------------- 1 | /* Include file GAPS class type identifier */ 2 | 3 | 4 | 5 | /* Initialization functions */ 6 | 7 | int RNInitClassType(); 8 | void RNStopClassType(); 9 | 10 | 11 | 12 | /* Type definitions */ 13 | 14 | typedef int RNClassID; 15 | 16 | 17 | 18 | /* Class definition */ 19 | 20 | class RNClassType { 21 | public: 22 | // Constructor functions 23 | RNClassType(RNClassID id, const char *name); 24 | RNClassType(const char *name); 25 | ~RNClassType(void); 26 | 27 | // Property functions 28 | const RNClassID ID(void) const; 29 | const char *Name(void) const; 30 | 31 | private: 32 | RNClassID id; 33 | char *name; 34 | }; 35 | 36 | 37 | 38 | /* Public constants */ 39 | 40 | #define RN_UNKNOWN_CLASS_ID (-1) 41 | #define RN_NULL_CLASS_ID (0) 42 | 43 | 44 | 45 | /* Public variables */ 46 | 47 | extern const RNClassType RNnull_class_type; 48 | 49 | 50 | 51 | /* Useful macros */ 52 | 53 | #define RN_CLASS_TYPE_DECLARATIONS(__class) \ 54 | virtual const RNClassID ClassID(void) const; \ 55 | virtual const char *ClassName(void) const; \ 56 | virtual const RNClassType& ClassType(void) const; \ 57 | static const RNClassID CLASS_ID(void); \ 58 | static const char * CLASS_NAME(void); \ 59 | static const RNClassType& CLASS_TYPE(void) 60 | 61 | #define RN_CLASS_TYPE_DEFINITIONS(__class) \ 62 | const RNClassType __class ## _class_type ( #__class ); \ 63 | const RNClassID __class::ClassID(void) const { return CLASS_ID(); } \ 64 | const char *__class::ClassName(void) const { return CLASS_NAME(); } \ 65 | const RNClassType& __class::ClassType(void) const { return CLASS_TYPE(); } \ 66 | const RNClassID __class::CLASS_ID(void) { return CLASS_TYPE().ID(); } \ 67 | const char * __class::CLASS_NAME(void) { return CLASS_TYPE().Name(); } \ 68 | const RNClassType& __class::CLASS_TYPE(void) { return __class ## _class_type; } 69 | 70 | 71 | 72 | 73 | /* Inline functions */ 74 | 75 | inline const RNClassID RNClassType:: 76 | ID(void) const 77 | { 78 | // Return class id 79 | return id; 80 | } 81 | 82 | 83 | 84 | inline const char *RNClassType:: 85 | Name(void) const 86 | { 87 | // Return class name 88 | return name; 89 | } 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=RNMath 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | CCSRCS=$(NAME).cpp \ 14 | RNPolynomial.cpp RNAlgebraic.cpp RNEquation.cpp RNSystemOfEquations.cpp \ 15 | RNDenseLUMatrix.cpp RNDenseMatrix.cpp RNMatrix.cpp \ 16 | RNVector.cpp 17 | 18 | 19 | # 20 | # Dependencies 21 | # 22 | 23 | PKG_DEPENDENCIES = RNBasics 24 | 25 | 26 | 27 | # 28 | # PKG makefile 29 | # 30 | 31 | include ../../makefiles/Makefile.pkgs 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNDenseLUMatrix.h: -------------------------------------------------------------------------------- 1 | // Include file for abstract matrix class 2 | 3 | 4 | 5 | // Class definition 6 | 7 | class RNDenseLUMatrix : public RNDenseMatrix { 8 | public: 9 | // Constructor/destructor 10 | RNDenseLUMatrix(void); 11 | RNDenseLUMatrix(int nrows, int ncols, RNScalar *values = NULL); 12 | RNDenseLUMatrix(const RNDenseLUMatrix& matrix); 13 | RNDenseLUMatrix(const RNDenseMatrix& matrix); 14 | RNDenseLUMatrix(const RNMatrix& matrix); 15 | virtual ~RNDenseLUMatrix(void); 16 | 17 | // Property functions/operators 18 | virtual RNScalar Determinant(void) const; 19 | virtual RNDenseMatrix Inverse(void) const; 20 | 21 | // Factoring functions/operations 22 | int DecomposeLU(RNDenseMatrix& L, RNDenseMatrix& U) const; 23 | 24 | protected: 25 | // Utility functions 26 | void Decompose(void); 27 | void BackSubstitute(RNDenseMatrix &b, RNDenseMatrix &x) const; 28 | 29 | private: 30 | int *pivots; 31 | }; 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNEquation.cpp: -------------------------------------------------------------------------------- 1 | // Source file for equation class 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // Include files 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | #include "RNMath/RNMath.h" 10 | 11 | 12 | 13 | //////////////////////////////////////////////////////////////////////// 14 | // Functions 15 | //////////////////////////////////////////////////////////////////////// 16 | 17 | RNEquation:: 18 | RNEquation(void) 19 | : RNExpression(), 20 | system(NULL), 21 | system_index(-1), 22 | residual_threshold(0) 23 | { 24 | } 25 | 26 | 27 | 28 | RNEquation:: 29 | RNEquation(RNPolynomial *polynomial) 30 | : RNExpression(polynomial), 31 | system(NULL), 32 | system_index(-1), 33 | residual_threshold(0) 34 | { 35 | } 36 | 37 | 38 | 39 | RNEquation:: 40 | RNEquation(RNAlgebraic *algebraic) 41 | : RNExpression(algebraic), 42 | system(NULL), 43 | system_index(-1), 44 | residual_threshold(0) 45 | { 46 | } 47 | 48 | 49 | 50 | RNEquation:: 51 | RNEquation(RNScalar c, int nv, const int *v, const RNScalar *e, RNBoolean already_sorted) 52 | : RNExpression(c, nv, v, e, already_sorted), 53 | system(NULL), 54 | system_index(-1), 55 | residual_threshold(0) 56 | { 57 | } 58 | 59 | 60 | 61 | RNEquation:: 62 | RNEquation(int operation, RNExpression *operand1, RNExpression *operand2) 63 | : RNExpression(operation, operand1, operand2), 64 | system(NULL), 65 | system_index(-1), 66 | residual_threshold(0) 67 | { 68 | } 69 | 70 | 71 | 72 | RNEquation:: 73 | RNEquation(const RNPolynomial& polynomial, int dummy) 74 | : RNExpression(polynomial, dummy), 75 | system(NULL), 76 | system_index(-1), 77 | residual_threshold(0) 78 | { 79 | } 80 | 81 | 82 | 83 | RNEquation:: 84 | RNEquation(const RNExpression& expression, int dummy) 85 | : RNExpression(expression), 86 | system(NULL), 87 | system_index(-1), 88 | residual_threshold(0) 89 | { 90 | } 91 | 92 | 93 | 94 | RNEquation:: 95 | RNEquation(const RNEquation& equation) 96 | : RNExpression(equation), 97 | system(NULL), 98 | system_index(-1), 99 | residual_threshold(equation.residual_threshold) 100 | { 101 | } 102 | 103 | 104 | 105 | RNEquation:: 106 | ~RNEquation(void) 107 | { 108 | // Remove from system of equations 109 | if (system) system->RemoveEquation(this); 110 | } 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNEquation.h: -------------------------------------------------------------------------------- 1 | // Include file for equation class 2 | 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////// 6 | // Class definition 7 | //////////////////////////////////////////////////////////////////////// 8 | 9 | class RNEquation : public RNExpression { 10 | public: 11 | // Constructor/destructor 12 | RNEquation(void); 13 | RNEquation(RNPolynomial *polynomial); 14 | RNEquation(RNAlgebraic *algebraic); 15 | RNEquation(RNScalar c, int nv, const int *v = NULL, const RNScalar *e = NULL, RNBoolean already_sorted = FALSE); 16 | RNEquation(int operation, RNAlgebraic *operand1, RNAlgebraic *operand2); 17 | RNEquation(const RNPolynomial& polynomial, int dummy); 18 | RNEquation(const RNExpression& expression, int dummy); 19 | RNEquation(const RNEquation& equation); 20 | virtual ~RNEquation(void); 21 | 22 | // Access functions 23 | RNSystemOfEquations *SystemOfEquations(void) const; 24 | int SystemIndex(void) const; 25 | 26 | // Evaluation functions 27 | RNScalar EvaluateResidual(const RNScalar *x) const; 28 | 29 | private: 30 | friend class RNSystemOfEquations; 31 | RNSystemOfEquations *system; 32 | int system_index; 33 | 34 | public: 35 | // Temporary 36 | RNScalar ResidualThreshold(void) const { return residual_threshold; }; 37 | void SetResidualThreshold(RNScalar threshold) { this->residual_threshold = threshold; }; 38 | RNScalar residual_threshold; 39 | }; 40 | 41 | 42 | 43 | //////////////////////////////////////////////////////////////////////// 44 | // Inline functions 45 | //////////////////////////////////////////////////////////////////////// 46 | 47 | inline RNSystemOfEquations *RNEquation:: 48 | SystemOfEquations(void) const 49 | { 50 | // Return system of equations this equation belongs to 51 | return system; 52 | } 53 | 54 | 55 | 56 | inline int RNEquation:: 57 | SystemIndex(void) const 58 | { 59 | // Return index of this equation in its system of equations 60 | return system_index; 61 | } 62 | 63 | 64 | 65 | inline RNScalar RNEquation:: 66 | EvaluateResidual(const RNScalar *x) const 67 | { 68 | // Evaluate expression 69 | return Evaluate(x); 70 | } 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMath.cpp: -------------------------------------------------------------------------------- 1 | /* Source file for GAPS math module */ 2 | 3 | 4 | 5 | /* Include files */ 6 | 7 | #include "RNMath.h" 8 | 9 | 10 | 11 | /* Private variables */ 12 | 13 | static int RNmath_active_count = 0; 14 | 15 | 16 | 17 | int RNInitMath(void) 18 | { 19 | // Check whether are already initialized 20 | if ((RNmath_active_count++) > 0) return TRUE; 21 | 22 | // Initialize submodules 23 | RNSeedRandomScalar(); 24 | 25 | // Return OK status 26 | return TRUE; 27 | } 28 | 29 | 30 | 31 | void RNStopMath(void) 32 | { 33 | // Check whether have been initialized 34 | if ((--RNmath_active_count) > 0) return; 35 | 36 | // Stop submodules 37 | // ??? 38 | } 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMath.h: -------------------------------------------------------------------------------- 1 | // Include file for RNMath package 2 | 3 | #ifndef __RN__MATH__H__ 4 | #define __RN__MATH__H__ 5 | 6 | 7 | 8 | 9 | // Dependency include files 10 | 11 | #include "RNBasics/RNBasics.h" 12 | 13 | 14 | 15 | // Declarations 16 | 17 | class RNVector; 18 | class RNMatrix; 19 | class RNDenseMatrix; 20 | class RNPolynomial; 21 | class RNPolynomialTerm; 22 | class RNAlgebraic; 23 | typedef RNAlgebraic RNExpression; 24 | class RNEquation; 25 | class RNSystemOfEquations; 26 | 27 | 28 | 29 | // Matrix classes 30 | 31 | #include "RNMath/RNLapack.h" 32 | #include "RNMath/RNVector.h" 33 | #include "RNMath/RNMatrix.h" 34 | #include "RNMath/RNDenseMatrix.h" 35 | #include "RNMath/RNDenseLUMatrix.h" 36 | 37 | 38 | // Expression and equation classes 39 | 40 | #include "RNMath/RNPolynomial.h" 41 | #include "RNMath/RNAlgebraic.h" 42 | #include "RNMath/RNEquation.h" 43 | #include "RNMath/RNSystemOfEquations.h" 44 | 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMatrix.cpp: -------------------------------------------------------------------------------- 1 | // Source file for abstract matrix class 2 | 3 | 4 | // Include files 5 | 6 | #include "RNMath.h" 7 | 8 | 9 | 10 | RNMatrix:: 11 | RNMatrix(void) 12 | { 13 | } 14 | 15 | 16 | 17 | RNMatrix:: 18 | RNMatrix(const RNMatrix& matrix) 19 | { 20 | } 21 | 22 | 23 | 24 | RNMatrix:: 25 | ~RNMatrix(void) 26 | { 27 | } 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gaps/pkgs/RNMath/RNMatrix.h: -------------------------------------------------------------------------------- 1 | // Include file for abstract matrix class 2 | 3 | 4 | 5 | // Class definition 6 | 7 | class RNMatrix { 8 | public: 9 | // Constructor/destructor 10 | RNMatrix(void); 11 | RNMatrix(const RNMatrix& matrix); 12 | virtual ~RNMatrix(void); 13 | 14 | // Entry access 15 | virtual int NRows(void) const = 0; 16 | virtual int NColumns(void) const = 0; 17 | virtual RNScalar Value(int i, int j) const = 0; 18 | virtual void SetValue(int i, int j, RNScalar value) = 0; 19 | 20 | // Property functions/operators 21 | virtual RNBoolean IsDense(void) const = 0; 22 | virtual RNBoolean IsSparse(void) const = 0; 23 | }; 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/AUTHORS: -------------------------------------------------------------------------------- 1 | Pawel W. Olszta 2 | the person to be blamed for freeglut 3 | 4 | Andreas Umbach 5 | the first person to contribute to the freeglut project, 6 | contributed the cube and sphere geometry code 7 | 8 | Steve Baker 9 | joystick code (from his great PLIB), numerous hints 10 | tips on the freeglut usability 11 | and for taking the project over when Pawel bowed out 12 | 13 | Christopher John Purnell 14 | Don Heyse 15 | Dave McClurg 16 | John F. Fay 17 | Norman Vine 18 | Daniel Wagner 19 | Sven Panne 20 | contributing the project, using the product, and generally keeping it going 21 | 22 | Brian Paul 23 | Eric Sandall 24 | giving us the oomph! to make an official release 25 | 26 | James 'J.C.' Jones 27 | designing the new website 28 | 29 | ...and all the opengl-gamedev-l people that made Pawel start this project :) 30 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for freeglut library 3 | # 4 | 5 | 6 | 7 | # 8 | # Package name and list of source files. 9 | # 10 | 11 | NAME=fglut 12 | FGLUT_CSRCS = \ 13 | freeglut_callbacks.c \ 14 | freeglut_cursor.c \ 15 | freeglut_display.c \ 16 | freeglut_ext.c \ 17 | freeglut_font.c \ 18 | freeglut_glutfont_definitions.c \ 19 | freeglut_font_data.c \ 20 | freeglut_stroke_roman.c \ 21 | freeglut_stroke_mono_roman.c \ 22 | freeglut_gamemode.c \ 23 | freeglut_geometry.c \ 24 | freeglut_init.c \ 25 | freeglut_input_devices.c \ 26 | freeglut_spaceball.c \ 27 | freeglut_joystick.c \ 28 | freeglut_main.c \ 29 | freeglut_menu.c \ 30 | freeglut_misc.c \ 31 | freeglut_overlay.c \ 32 | freeglut_state.c \ 33 | freeglut_structure.c \ 34 | freeglut_teapot.c \ 35 | freeglut_videoresize.c \ 36 | freeglut_window.c 37 | 38 | ifeq ("$(shell uname -s)", "Darwin") 39 | CSRCS = $(NAME).c 40 | else 41 | CSRCS=$(FGLUT_CSRCS) 42 | endif 43 | 44 | 45 | 46 | # 47 | # R3 library makefile 48 | # 49 | 50 | include ../../makefiles/Makefile.pkgs 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/README: -------------------------------------------------------------------------------- 1 | 2 | BRIEF OVERVIEW 3 | ============== 4 | 5 | This is the freeglut package. 6 | 7 | Freeglut, the Free openGL Utility Toolkit, is meant to be a free alter- 8 | native to Mark Kilgard's GLUT library. It is distributed under an X-Consor- 9 | tium style license (see COPYING for details), to offer you a chance to use 10 | and/or modify the source. 11 | 12 | It makes use of OpenGL, GLU, and pthreads-win32 libraries. The library does 13 | not make use of any GLUT code and is not 100% compatible. Code recompilation 14 | and/or slight modifications might be required for your applications to work 15 | with freeglut. 16 | 17 | 18 | PORTS 19 | ===== 20 | 21 | Both X11 and Win32 ports are in an advanced alpha stage, which means that 22 | they provide limited functionality of GLUT API 3. There is an investigation 23 | en course to check if the BeOS port could be easily done using the current 24 | freeglut structure. 25 | 26 | 27 | INSTALLATION 28 | ============ 29 | 30 | Use the following commands to build from scratch on a *nix X11 platform: 31 | 32 | ./autogen.sh 33 | ./configure 34 | make 35 | 36 | The first command is only needed after a fresh checkout, a source distribution 37 | already contains all necessary files for the last two steps. 38 | 39 | 40 | CONTRIBUTING 41 | ============ 42 | 43 | Bug and missing features patches are certainly welcome. Just as comments 44 | and FREEGLUT API 1 propositions are. 45 | 46 | Just please to make the fixes look visually just as the rest of the code 47 | does (tabs converted 4 white spaces). Comments are really welcome, as I 48 | believe it would be nice for people fresh new to OpenGL see how the things 49 | are done... 50 | 51 | 52 | WEB SITE AND CONTACTING THE AUTHOR 53 | ================================== 54 | 55 | Freeglut project has moved to the SourceForge: 56 | http://freeglut.sourceforge.net 57 | 58 | 59 | THE HOPE 60 | ======== 61 | 62 | Hope you find my work somehow useful. 63 | Pawel W. Olszta, 64 | 65 | 66 | PASSING THE BATON 67 | ================= 68 | 69 | In late December 2000, Pawel decided that he no longer 70 | wished to maintain freeglut because he has moved out of 71 | the graphics field. I volunteered to take over from him 72 | and have been running the project since Jan 13th 2001. 73 | 74 | I'm also the author and maintainer of the PLIB library suite 75 | and 'freeglut' really fits in well with that work. 76 | 77 | I just hope I can live up to Pawel's high standards. Pawel 78 | remains on the active developers list. 79 | 80 | Steve Baker 81 | http://plib.sourceforge.net 82 | 83 | 84 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.c: -------------------------------------------------------------------------------- 1 | // Source file for fglut package stand-in 2 | 3 | 4 | 5 | // These are never used. They are just dummy functions 6 | // to compile and link when the native glut is used, and 7 | // thus the rest of the code in the fglut package is not 8 | // compiled 9 | 10 | 11 | 12 | int R3InitGlut(void) 13 | { 14 | // return OK status 15 | return 1; 16 | } 17 | 18 | 19 | 20 | void R3StopGlut(void) 21 | { 22 | } 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.h: -------------------------------------------------------------------------------- 1 | // OpenGL GLUT include file 2 | 3 | 4 | // External include files 5 | 6 | #ifdef __APPLE__ 7 | // Use the native glut on mac 8 | # include "GLUT/glut.h" 9 | #else 10 | // Use this implementation 11 | # include "fglut/glut.h" 12 | #endif 13 | 14 | 15 | 16 | /* Initialization functions */ 17 | 18 | int R3InitGlut(void); 19 | void R3StopGlut(void); 20 | 21 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/fglut.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fglut", "fglut.vcxproj", "{245FD70C-6B13-4581-B674-838551C69144}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {245FD70C-6B13-4581-B674-838551C69144}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {245FD70C-6B13-4581-B674-838551C69144}.Debug|Win32.Build.0 = Debug|Win32 14 | {245FD70C-6B13-4581-B674-838551C69144}.Release|Win32.ActiveCfg = Release|Win32 15 | {245FD70C-6B13-4581-B674-838551C69144}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/freeglut_overlay.c: -------------------------------------------------------------------------------- 1 | /* 2 | * freeglut_overlay.c 3 | * 4 | * Overlay management functions (as defined by GLUT API) 5 | * 6 | * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. 7 | * Written by Pawel W. Olszta, 8 | * Creation date: Thu Dec 16 1999 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a 11 | * copy of this software and associated documentation files (the "Software"), 12 | * to deal in the Software without restriction, including without limitation 13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | * and/or sell copies of the Software, and to permit persons to whom the 15 | * Software is furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included 18 | * in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 24 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "freeglut.h" 29 | #include "freeglut_internal.h" 30 | 31 | /* 32 | * NOTE: functions declared in this file probably will not be implemented. 33 | */ 34 | 35 | /* -- INTERFACE FUNCTIONS -------------------------------------------------- */ 36 | 37 | void FGAPIENTRY glutEstablishOverlay( void ) { /* Not implemented */ } 38 | void FGAPIENTRY glutRemoveOverlay( void ) { /* Not implemented */ } 39 | void FGAPIENTRY glutUseLayer( GLenum layer ) { /* Not implemented */ } 40 | void FGAPIENTRY glutPostOverlayRedisplay( void ) { /* Not implemented */ } 41 | void FGAPIENTRY glutPostWindowOverlayRedisplay( int ID ) { /* Not implemented */ } 42 | void FGAPIENTRY glutShowOverlay( void ) { /* Not implemented */ } 43 | void FGAPIENTRY glutHideOverlay( void ) { /* Not implemented */ } 44 | 45 | /*** END OF FILE ***/ 46 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/freeglut_videoresize.c: -------------------------------------------------------------------------------- 1 | /* 2 | * freeglut_videoresize.c 3 | * 4 | * Video resize functions (as defined by GLUT API) 5 | * 6 | * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. 7 | * Written by Pawel W. Olszta, 8 | * Creation date: Thu Dec 16 1999 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a 11 | * copy of this software and associated documentation files (the "Software"), 12 | * to deal in the Software without restriction, including without limitation 13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | * and/or sell copies of the Software, and to permit persons to whom the 15 | * Software is furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included 18 | * in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 24 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "freeglut.h" 29 | #include "freeglut_internal.h" 30 | 31 | /* 32 | * NOTE: functions declared in this file probably will not be implemented. 33 | */ 34 | 35 | /* -- INTERFACE FUNCTIONS -------------------------------------------------- */ 36 | 37 | int FGAPIENTRY glutVideoResizeGet( GLenum eWhat ) { return( 0x00 ); } 38 | void FGAPIENTRY glutSetupVideoResizing( void ) { /* Not implemented */ } 39 | void FGAPIENTRY glutStopVideoResizing( void ) { /* Not implemented */ } 40 | void FGAPIENTRY glutVideoResize( int x, int y, int w, int h ) { /* Not implemented */ } 41 | void FGAPIENTRY glutVideoPan( int x, int y, int w, int h ) { /* Not implemented */ } 42 | 43 | /*** END OF FILE ***/ 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /gaps/pkgs/fglut/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /gaps/pkgs/gaps.h: -------------------------------------------------------------------------------- 1 | // Include file for gaps packages 2 | 3 | #ifndef __GAPS__H__ 4 | #define __GAPS__H__ 5 | 6 | 7 | // Include all packages 8 | 9 | #include "RNBasics/RNBasics.h" 10 | #include "R2Shapes/R2Shapes.h" 11 | #include "R3Shapes/R3Shapes.h" 12 | #include "R3Graphics/R3Graphics.h" 13 | 14 | 15 | #endif 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=jpeg 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | # library object files common to compression and decompression 14 | COMSRCS= jcomapi.c jutils.c jerror.c jmemmgr.c jmemnobs.c 15 | 16 | # compression library object files 17 | CLIBSRCS= jcapimin.c jcapistd.c jctrans.c jcparam.c \ 18 | jdatadst.c jcinit.c jcmaster.c jcmarker.c jcmainct.c \ 19 | jcprepct.c jccoefct.c jccolor.c jcsample.c jchuff.c \ 20 | jcphuff.c jcdctmgr.c jfdctfst.c jfdctflt.c \ 21 | jfdctint.c 22 | 23 | # decompression library object files 24 | DLIBSRCS= jdapimin.c jdapistd.c jdtrans.c jdatasrc.c \ 25 | jdmaster.c jdinput.c jdmarker.c jdhuff.c jdphuff.c \ 26 | jdmainct.c jdcoefct.c jdpostct.c jddctmgr.c \ 27 | jidctfst.c jidctflt.c jidctint.c jidctred.c \ 28 | jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c 29 | 30 | # JPEG library source files 31 | CSRCS=$(CLIBSRCS) $(DLIBSRCS) $(COMSRCS) 32 | 33 | 34 | 35 | # 36 | # GAPS library makefile 37 | # 38 | 39 | include ../../makefiles/Makefile.pkgs 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jchuff.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jchuff.h 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for Huffman entropy encoding routines 9 | * that are shared between the sequential encoder (jchuff.c) and the 10 | * progressive encoder (jcphuff.c). No other modules need to see these. 11 | */ 12 | 13 | /* The legal range of a DCT coefficient is 14 | * -1024 .. +1023 for 8-bit data; 15 | * -16384 .. +16383 for 12-bit data. 16 | * Hence the magnitude should always fit in 10 or 14 bits respectively. 17 | */ 18 | 19 | #if BITS_IN_JSAMPLE == 8 20 | #define MAX_COEF_BITS 10 21 | #else 22 | #define MAX_COEF_BITS 14 23 | #endif 24 | 25 | /* Derived data constructed for each Huffman table */ 26 | 27 | typedef struct { 28 | unsigned int ehufco[256]; /* code for each symbol */ 29 | char ehufsi[256]; /* length of code for each symbol */ 30 | /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 31 | } c_derived_tbl; 32 | 33 | /* Short forms of external names for systems with brain-damaged linkers. */ 34 | 35 | #ifdef NEED_SHORT_EXTERNAL_NAMES 36 | #define jpeg_make_c_derived_tbl jMkCDerived 37 | #define jpeg_gen_optimal_table jGenOptTbl 38 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 39 | 40 | /* Expand a Huffman table definition into the derived format */ 41 | EXTERN(void) jpeg_make_c_derived_tbl 42 | JPP((j_compress_ptr cinfo, jboolean isDC, int tblno, 43 | c_derived_tbl ** pdtbl)); 44 | 45 | /* Generate an optimal table definition given the specified counts */ 46 | EXTERN(void) jpeg_gen_optimal_table 47 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); 48 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jcinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcinit.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains initialization logic for the JPEG compressor. 9 | * This routine is in charge of selecting the modules to be executed and 10 | * making an initialization call to each one. 11 | * 12 | * Logically, this code belongs in jcmaster.c. It's split out because 13 | * linking this routine implies linking the entire compression library. 14 | * For a transcoding-only application, we want to be able to use jcmaster.c 15 | * without linking in the whole library. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | 22 | 23 | /* 24 | * Master selection of compression modules. 25 | * This is done once at the start of processing an image. We determine 26 | * which modules will be used and give them appropriate initialization calls. 27 | */ 28 | 29 | GLOBAL(void) 30 | jinit_compress_master (j_compress_ptr cinfo) 31 | { 32 | /* Initialize master control (includes parameter checking/processing) */ 33 | jinit_c_master_control(cinfo, FALSE /* full compression */); 34 | 35 | /* Preprocessing */ 36 | if (! cinfo->raw_data_in) { 37 | jinit_color_converter(cinfo); 38 | jinit_downsampler(cinfo); 39 | jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 40 | } 41 | /* Forward DCT */ 42 | jinit_forward_dct(cinfo); 43 | /* Entropy encoding: either Huffman or arithmetic coding. */ 44 | if (cinfo->arith_code) { 45 | ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 46 | } else { 47 | if (cinfo->progressive_mode) { 48 | #ifdef C_PROGRESSIVE_SUPPORTED 49 | jinit_phuff_encoder(cinfo); 50 | #else 51 | ERREXIT(cinfo, JERR_NOT_COMPILED); 52 | #endif 53 | } else 54 | jinit_huff_encoder(cinfo); 55 | } 56 | 57 | /* Need a full-image coefficient buffer in any multi-pass mode. */ 58 | jinit_c_coef_controller(cinfo, 59 | (jboolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); 60 | jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 61 | 62 | jinit_marker_writer(cinfo); 63 | 64 | /* We can now tell the memory manager to allocate virtual arrays. */ 65 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 66 | 67 | /* Write the datastream header (SOI) immediately. 68 | * Frame and scan headers are postponed till later. 69 | * This lets application insert special markers after the SOI. 70 | */ 71 | (*cinfo->marker->write_file_header) (cinfo); 72 | } 73 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.h. Generated automatically by configure. */ 2 | /* jconfig.cfg --- source file edited by configure script */ 3 | /* see jconfig.doc for explanations */ 4 | 5 | #define HAVE_PROTOTYPES 6 | #define HAVE_UNSIGNED_CHAR 7 | #define HAVE_UNSIGNED_SHORT 8 | #undef void 9 | #undef const 10 | #undef CHAR_IS_UNSIGNED 11 | #define HAVE_STDDEF_H 12 | #define HAVE_STDLIB_H 13 | #undef NEED_BSD_STRINGS 14 | #undef NEED_SYS_TYPES_H 15 | #undef NEED_FAR_POINTERS 16 | #undef NEED_SHORT_EXTERNAL_NAMES 17 | #undef INCOMPLETE_TYPES_BROKEN 18 | 19 | -------------------------------------------------------------------------------- /gaps/pkgs/jpeg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /gaps/pkgs/png/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Package name 3 | # 4 | 5 | NAME=png 6 | 7 | 8 | 9 | # 10 | # List of source files 11 | # 12 | 13 | # JPEG library source files 14 | PNG_CSRCS = \ 15 | png.c \ 16 | pngset.c \ 17 | pngget.c \ 18 | pngrutil.c \ 19 | pngtrans.c \ 20 | pngwutil.c \ 21 | pngread.c \ 22 | pngrio.c \ 23 | pngwio.c \ 24 | pngwrite.c \ 25 | pngrtran.c \ 26 | pngwtran.c \ 27 | pngmem.c \ 28 | pngerror.c \ 29 | pngpread.c 30 | 31 | ZLIB_CSRCS = \ 32 | adler32.c \ 33 | compress.c \ 34 | crc32.c \ 35 | deflate.c \ 36 | gzclose.c \ 37 | gzlib.c \ 38 | gzread.c \ 39 | gzwrite.c \ 40 | infback.c \ 41 | inffast.c \ 42 | inflate.c \ 43 | inftrees.c \ 44 | trees.c \ 45 | uncompr.c \ 46 | zutil.c 47 | 48 | CSRCS = $(PNG_CSRCS) $(ZLIB_CSRCS) 49 | 50 | 51 | 52 | # 53 | # GAPS library makefile 54 | # 55 | 56 | include ../../makefiles/Makefile.pkgs 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /gaps/pkgs/png/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_DLFCN_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_INTTYPES_H 1 9 | 10 | /* Define to 1 if you have the `m' library (-lm). */ 11 | /* #undef HAVE_LIBM */ 12 | 13 | /* Define to 1 if you have the `z' library (-lz). */ 14 | #define HAVE_LIBZ 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_MALLOC_H 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_MEMORY_H 1 21 | 22 | /* Define to 1 if you have the `memset' function. */ 23 | #define HAVE_MEMSET 1 24 | 25 | /* Define to 1 if you have the `pow' function. */ 26 | #define HAVE_POW 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_STDINT_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_STDLIB_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_STRINGS_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_STRING_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_SYS_STAT_H 1 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #define HAVE_SYS_TYPES_H 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_UNISTD_H 1 48 | 49 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 50 | */ 51 | #define LT_OBJDIR ".libs/" 52 | 53 | /* Name of package */ 54 | #define PACKAGE "libpng" 55 | 56 | /* Define to the address where bug reports for this package should be sent. */ 57 | #define PACKAGE_BUGREPORT "png-mng-implement@lists.sourceforge.net" 58 | 59 | /* Define to the full name of this package. */ 60 | #define PACKAGE_NAME "libpng" 61 | 62 | /* Define to the full name and version of this package. */ 63 | #define PACKAGE_STRING "libpng 1.4.4" 64 | 65 | /* Define to the one symbol short name of this package. */ 66 | #define PACKAGE_TARNAME "libpng" 67 | 68 | /* Define to the home page for this package. */ 69 | #define PACKAGE_URL "" 70 | 71 | /* Define to the version of this package. */ 72 | #define PACKAGE_VERSION "1.4.4" 73 | 74 | /* Define to 1 if you have the ANSI C header files. */ 75 | #define STDC_HEADERS 1 76 | 77 | /* Define to 1 if your declares `struct tm'. */ 78 | /* #undef TM_IN_SYS_TIME */ 79 | 80 | /* Version number of package */ 81 | #define VERSION "1.4.4" 82 | 83 | /* Define to empty if `const' does not conform to ANSI C. */ 84 | /* #undef const */ 85 | 86 | /* Define to `unsigned int' if does not define. */ 87 | /* #undef size_t */ 88 | -------------------------------------------------------------------------------- /gaps/pkgs/png/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /gaps/pkgs/png/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /gaps/pkgs/png/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | 20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 21 | enough memory, Z_BUF_ERROR if there was not enough room in the output 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. 23 | */ 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 25 | Bytef *dest; 26 | uLongf *destLen; 27 | const Bytef *source; 28 | uLong sourceLen; 29 | { 30 | z_stream stream; 31 | int err; 32 | 33 | stream.next_in = (Bytef*)source; 34 | stream.avail_in = (uInt)sourceLen; 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | 45 | err = inflateInit(&stream); 46 | if (err != Z_OK) return err; 47 | 48 | err = inflate(&stream, Z_FINISH); 49 | if (err != Z_STREAM_END) { 50 | inflateEnd(&stream); 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 52 | return Z_DATA_ERROR; 53 | return err; 54 | } 55 | *destLen = stream.total_out; 56 | 57 | err = inflateEnd(&stream); 58 | return err; 59 | } 60 | -------------------------------------------------------------------------------- /gaps/vc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS visual studio release 3 | # 4 | 5 | 6 | # 7 | # Set up options, etc. 8 | # 9 | 10 | RELEASE_DIR=../release 11 | 12 | 13 | 14 | # 15 | # Make targets 16 | # 17 | 18 | opt: 19 | 20 | debug: 21 | 22 | release: 23 | mkdir -p $(RELEASE_DIR)/vc 24 | cp vc.sln $(RELEASE_DIR)/vc 25 | cp -r glut $(RELEASE_DIR)/vc 26 | mkdir -p $(RELEASE_DIR)/bin 27 | mkdir -p $(RELEASE_DIR)/lib 28 | mkdir -p $(RELEASE_DIR)/bin/win32 29 | mkdir -p $(RELEASE_DIR)/lib/win32 30 | cp glut/glut32.dll $(RELEASE_DIR)/bin/win32 31 | cp glut/glut32.lib $(RELEASE_DIR)/lib/win32 32 | cp Makefile $(RELEASE_DIR)/vc 33 | cp README.txt $(RELEASE_DIR)/vc 34 | 35 | clean: 36 | - rm -f -r Debug Release ../bin/win32/*.exe ../bin/win32/*.ilk ../bin/win32/*.pdb ../lib/win32/*.lib vc.ncb vc.suo vc.sdf *~ 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /gaps/vc/README.txt: -------------------------------------------------------------------------------- 1 | To compile, you should be able to open vc.sln and "Rebuild Solution. 2 | 3 | ------------------------------------------------------------------------ 4 | 5 | This file contains notes about settings made when creating the vc.sln file. 6 | 7 | All: 8 | General: Output Directory = $(SolutionDir)/$(ConfigurationName)/$(ProjectName) 9 | General: Intermediate Directory = $(SolutionDir)/$(ConfigurationName)/$(ProjectName) 10 | Input: Additional Dependencies = R3Graphics.lib R3Shapes.lib R2Shapes.lib RNBasics.lib jpeg.lib glut32.lib glu32.lib opengl32.lib 11 | C/C++: General: Additional Include Directories = ../../pkgs 12 | C/C++: Advanced: Comple as C++ Code (Set TP explicitly) --- except jpeg, png, fglut 13 | C/C++: Advanced: Disable Specific warnings 4244, 4267, 4996 14 | 15 | For pkgs: 16 | Librarian: General: Output File = ../../lib/win32/${ProjectName}.lib 17 | 18 | For apps: 19 | Linker: General:Additional Library Directories = ../../lib/win32 20 | Linker: General: Output file = ../../bin/win32/$(ProjectName).exe 21 | -------------------------------------------------------------------------------- /gaps/vc/glut/glut32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjhartmann/SUNCGtoolbox/23a22a5f913ba3ab6989005a129278ed20dbd0f3/gaps/vc/glut/glut32.dll -------------------------------------------------------------------------------- /gaps/vc/glut/glut32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjhartmann/SUNCGtoolbox/23a22a5f913ba3ab6989005a129278ed20dbd0f3/gaps/vc/glut/glut32.lib -------------------------------------------------------------------------------- /gaps/vc/makefiles/Makefile.apps: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS applications 3 | # 4 | 5 | 6 | 7 | # 8 | # Before this Makefile is included ... 9 | # $(NAME) should be module name 10 | # $(CCSRCS) should list C++ source files 11 | # 12 | # For example ... 13 | # NAME=foo 14 | # CCSRCS=$(NAME).C \ 15 | # foo1.C foo2.C foo3.C 16 | # 17 | 18 | 19 | # 20 | # Set up compiler options, etc. 21 | # 22 | 23 | include ../../scripts/Makefile.std 24 | 25 | 26 | 27 | # 28 | # Set up target executable 29 | # 30 | 31 | EXE=$(EXE_DIR)/$(NAME).exe 32 | 33 | 34 | 35 | # 36 | # Set up link options 37 | # 38 | 39 | BASE_LDFLAGS=$(USER_LDFLAGS) /link /libpath:$(LIB_DIR) 40 | DEBUG_LDFLAGS=$(BASE_LDFLAGS) -Zi 41 | OPT_LDFLAGS=$(BASE_LDFLAGS) -Ox 42 | LDFLAGS=$(DEBUG_LDFLAGS) 43 | 44 | 45 | 46 | # 47 | # Set up libs 48 | # 49 | 50 | OPENGL_LIBS=glut32.lib glu32.lib opengl32.lib 51 | STD_LIBS =wsock32.lib user32.lib gdi32.lib advapi32.lib 52 | LIBS=$(USER_LIBS) $(PKG_LIBS) $(OPENGL_LIBS) $(STD_LIBS) 53 | 54 | 55 | 56 | # 57 | # Make targets 58 | # 59 | 60 | opt: 61 | $(MAKE) $(EXE) "CFLAGS=$(OPT_CFLAGS)" "LDFLAGS=$(OPT_LDFLAGS)" 62 | 63 | debug: 64 | $(MAKE) $(EXE) "CFLAGS=$(DEBUG_CFLAGS)" "LDFLAGS=$(DEBUG_LDFLAGS)" 65 | 66 | $(EXE): $(OBJS) $(LIBDIR) 67 | mkdir -p $(EXE_DIR) 68 | $(CC) -o $(EXE) $(OBJS) $(LDFLAGS) $(LIBS) 69 | 70 | release: 71 | mkdir -p $(RELEASE_DIR)/apps 72 | mkdir $(RELEASE_DIR)/apps/$(NAME)1 73 | cp *.[cCIh] $(RELEASE_DIR)/apps/$(NAME)1 74 | cp Makefile $(RELEASE_DIR)/apps/$(NAME)1 75 | rm -r -f $(RELEASE_DIR)/apps/$(NAME) 76 | mv $(RELEASE_DIR)/apps/$(NAME)1 $(RELEASE_DIR)/apps/$(NAME) 77 | 78 | clean: 79 | - rm -f *~ *.obj $(EXE) 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /gaps/vc/makefiles/Makefile.pkgs: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for GAPS packages 3 | # 4 | 5 | 6 | 7 | # 8 | # Before this Makefile is included ... 9 | # $(NAME) should be module name 10 | # $(CCSRCS) should list C++ source files 11 | # $(CSRCS) should list C source files 12 | # 13 | # For example ... 14 | # NAME=foo 15 | # CCSRCS=$(NAME).C \ 16 | # foo1.C foo2.C foo3.C 17 | # CSRCS=foo4.c foo5.c 18 | # 19 | 20 | 21 | # 22 | # Set up compiler options, etc. 23 | # 24 | 25 | include ../../scripts/Makefile.std 26 | 27 | 28 | 29 | # 30 | # Set up target name 31 | # 32 | 33 | LIB=${LIB_DIR}/$(NAME).lib 34 | 35 | 36 | 37 | # 38 | # Make targets 39 | # 40 | 41 | opt: 42 | $(MAKE) $(LIB) "CFLAGS=$(OPT_CFLAGS)" 43 | 44 | debug: 45 | $(MAKE) $(LIB) "CFLAGS=$(DEBUG_CFLAGS)" 46 | 47 | $(LIB): $(CCSRCS) $(CSRCS) $(OSRCS) $(OBJS) 48 | mkdir -p $(LIB_DIR) 49 | lib /OUT:$(LIB) $(OBJS) 50 | 51 | release: 52 | mkdir -p $(RELEASE_DIR)/pkgs 53 | mkdir $(RELEASE_DIR)/pkgs/$(NAME)1 54 | cp *.[cCIh] $(RELEASE_DIR)/pkgs/$(NAME)1 55 | cp Makefile $(RELEASE_DIR)/pkgs/$(NAME)1 56 | rm -r -f $(RELEASE_DIR)/pkgs/$(NAME) 57 | mv $(RELEASE_DIR)/pkgs/$(NAME)1 $(RELEASE_DIR)/pkgs/$(NAME) 58 | 59 | clean: 60 | - rm -f *~ *.obj $(LIB) 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /gaps/vc/makefiles/Makefile.std: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile setup for GAPS 3 | # 4 | 5 | 6 | 7 | # 8 | # Targets 9 | # 10 | 11 | OBJS=$(CCSRCS:.C=.obj) $(CCSRCS:.c=.obj) 12 | INCS=$(HSRCS) $(CCSRCS:.C=.h) 13 | 14 | 15 | 16 | # 17 | # C flags 18 | # 19 | 20 | CC=cl 21 | BASE_CFLAGS=$(USER_CFLAGS) /TP /W3 -I. -I../../pkgs 22 | DEBUG_CFLAGS=-Zi $(BASE_CFLAGS) 23 | OPT_CFLAGS=-Ox -DNDEBUG $(BASE_CFLAGS) 24 | CFLAGS=$(DEBUG_CFLAGS) 25 | 26 | 27 | 28 | # 29 | # Directories 30 | # 31 | 32 | RELEASE_DIR=../../release 33 | EXE_DIR=../../bin/win32 34 | LIB_DIR=../../lib/win32 35 | 36 | 37 | 38 | # 39 | # Default rules 40 | # 41 | 42 | .SUFFIXES: .c .C .obj 43 | 44 | .C.obj: 45 | $(CC) $(CFLAGS) -c $< 46 | 47 | .c.obj: 48 | $(CC) $(CFLAGS) -c $< 49 | 50 | 51 | --------------------------------------------------------------------------------