From 1ef6e4eb266c3f7605eff2a6926b9b594a922155 Mon Sep 17 00:00:00 2001 From: GunjanArchistar Date: Wed, 1 Dec 2021 08:42:40 +1100 Subject: [PATCH] Adding [Serializable] attribute to geometry3Sharp objects to allow BinaryFormatter serialization geometry3Sharp is popular and been used in many projects. most projects has their own objects where geometry3Sharp objects are being used and in modern applications cloning/caching/serialization is very common. C#.Net's native BinaryFormatter is fastest way of serializing big objects which you can only do with the objects decorated using [Serializable] attribute. And also the own project classes are not BinaryFormatter serializable if geometry3Sharp objects are used in it. This change will help many projects. --- approximation/BiArcFit2.cs | 2 +- approximation/GaussPointsFit3.cs | 2 +- approximation/OrthogonalPlaneFit3.cs | 2 +- color/ColorHSV.cs | 2 +- color/ColorMap.cs | 2 +- color/Colorb.cs | 2 +- color/Colorf.cs | 2 +- comp_geom/Arrangement2d.cs | 2 +- comp_geom/ConvexHull2.cs | 2 +- comp_geom/GraphCells2d.cs | 2 +- comp_geom/GraphSplitter2d.cs | 2 +- comp_geom/SphericalFibonacciPointSet.cs | 2 +- containment/ContBox3.cs | 2 +- containment/ContMinBox2.cs | 2 +- containment/ContMinCircle2.cs | 2 +- core/BufferUtil.cs | 4 +- core/CommandArgumentSet.cs | 2 +- core/DVector.cs | 4 +- core/DVectorArray.cs | 18 ++++---- core/DijkstraGraphDistance.cs | 2 +- core/DynamicPriorityQueue.cs | 2 +- core/HBitArray.cs | 2 +- core/HashUtil.cs | 2 +- core/IndexPriorityQueue.cs | 2 +- core/Indexing.cs | 14 +++---- core/MemoryPool.cs | 2 +- core/ProfileUtil.cs | 4 +- core/ProgressCancel.cs | 4 +- core/RefCountVector.cs | 2 +- core/SafeCollections.cs | 2 +- core/SmallListSet.cs | 2 +- core/Snapping.cs | 2 +- core/SparseList.cs | 4 +- core/TagSet.cs | 6 +-- core/Util.cs | 4 +- core/VectorArray.cs | 22 +++++----- core/g3Iterators.cs | 8 ++-- core/gParallel.cs | 8 ++-- curve/Arc2.cs | 2 +- curve/ArcLengthParam.cs | 8 ++-- curve/BSplineBasis.cs | 2 +- curve/BezierCurve2.cs | 2 +- curve/Circle2.cs | 2 +- curve/CurveResampler.cs | 2 +- curve/CurveUtils.cs | 4 +- curve/DCurve3.cs | 2 +- curve/DGraph.cs | 8 ++-- curve/DGraph2.cs | 2 +- curve/DGraph2Resampler.cs | 2 +- curve/DGraph2Util.cs | 2 +- curve/DGraph3.cs | 2 +- curve/DGraph3Util.cs | 2 +- curve/Ellipse2.cs | 2 +- curve/EllipseArc2.cs | 2 +- curve/GeneralPolygon2d.cs | 2 +- curve/Hexagon2.cs | 2 +- curve/LaplacianCurveDeformer.cs | 4 +- curve/NURBSCurve2.cs | 4 +- curve/ParametricCurveSequence2.cs | 2 +- curve/PlanarComplex.cs | 20 ++++----- curve/PlanarSolid2d.cs | 2 +- curve/PolyLine2d.cs | 4 +- curve/PolyLine2f.cs | 6 +-- curve/PolyLine3d.cs | 2 +- curve/PolySimplification2.cs | 2 +- curve/Polygon2d.cs | 4 +- curve/PolygonFont2d.cs | 4 +- curve/SculptCurveDeformers.cs | 8 ++-- curve/SimpleCurveDeformers.cs | 4 +- distance/DistLine2Line2.cs | 2 +- distance/DistLine2Segment2.cs | 2 +- distance/DistLine3Ray3.cs | 2 +- distance/DistLine3Segment3.cs | 2 +- distance/DistLine3Triangle3.cs | 2 +- distance/DistPoint2Box2.cs | 2 +- distance/DistPoint2Circle2.cs | 2 +- distance/DistPoint3Circle3.cs | 2 +- distance/DistPoint3Cylinder3.cs | 2 +- distance/DistPoint3Triangle3.cs | 2 +- distance/DistRay3Ray3.cs | 2 +- distance/DistRay3Segment3.cs | 2 +- distance/DistSegment2Segment2.cs | 2 +- distance/DistSegment3Triangle3.cs | 2 +- distance/DistTriangle3Triangle3.cs | 2 +- implicit/CachingGridImplicit3d.cs | 2 +- implicit/CachingMeshSDF.cs | 6 +-- implicit/FalloffFunctions.cs | 4 +- implicit/GridImplicits3d.cs | 2 +- implicit/Implicit2d.cs | 2 +- implicit/Implicit3d.cs | 42 +++++++++---------- implicit/ImplicitFieldSampler3d.cs | 4 +- implicit/MarchingQuads.cs | 2 +- intersection/Intersector1.cs | 2 +- intersection/IntrLine2Line2.cs | 2 +- intersection/IntrLine2Segment2.cs | 2 +- intersection/IntrLine2Triangle2.cs | 2 +- intersection/IntrLine3AxisAlignedBox3.cs | 2 +- intersection/IntrLine3Box3.cs | 2 +- intersection/IntrRay3AxisAlignedBox3.cs | 2 +- intersection/IntrRay3Box3.cs | 2 +- intersection/IntrRay3Triangle3.cs | 2 +- intersection/IntrSegment2Segment2.cs | 2 +- intersection/IntrSegment2Triangle2.cs | 2 +- intersection/IntrSegment3Box3.cs | 2 +- intersection/IntrTriangle2Triangle2.cs | 2 +- intersection/IntrTriangle3Triangle3.cs | 2 +- io/BinaryG3ReaderWriter.cs | 4 +- io/MaterialTypes.cs | 4 +- io/MeshIO.cs | 12 +++--- io/OBJReader.cs | 2 +- io/OBJWriter.cs | 2 +- io/OFFWriter.cs | 2 +- io/STLReader.cs | 4 +- io/STLWriter.cs | 2 +- io/SVGWriter.cs | 4 +- io/StandardMeshReader.cs | 10 ++--- io/StandardMeshWriter.cs | 2 +- io/gSerialization.cs | 2 +- math/AxisAlignedBox2d.cs | 4 +- math/AxisAlignedBox2f.cs | 4 +- math/AxisAlignedBox2i.cs | 2 +- math/AxisAlignedBox3d.cs | 2 +- math/AxisAlignedBox3f.cs | 2 +- math/AxisAlignedBox3i.cs | 2 +- math/Box2.cs | 4 +- math/Box3.cs | 4 +- math/Frame3f.cs | 2 +- math/IndexTypes.cs | 6 +-- math/IndexUtil.cs | 2 +- math/Interval1d.cs | 2 +- math/Interval1i.cs | 2 +- math/Line2.cs | 4 +- math/Line3.cs | 4 +- math/Matrix2d.cs | 2 +- math/Matrix2f.cs | 2 +- math/Matrix3d.cs | 2 +- math/Matrix3f.cs | 2 +- math/Plane3.cs | 4 +- math/PrimalQuery2d.cs | 2 +- math/Quaterniond.cs | 2 +- math/Quaternionf.cs | 2 +- math/Query2.cs | 6 +-- math/Query2Integer.cs | 2 +- math/QueryTuple2d.cs | 2 +- math/Ray3.cs | 4 +- math/ScalarMap.cs | 2 +- math/Segment2.cs | 6 +-- math/Segment3.cs | 4 +- math/TransformSequence.cs | 2 +- math/TransformSequence2.cs | 2 +- math/Triangle2.cs | 4 +- math/Triangle3.cs | 4 +- math/Vector2d.cs | 4 +- math/Vector2f.cs | 2 +- math/Vector2i.cs | 4 +- math/Vector3d.cs | 2 +- math/Vector3f.cs | 2 +- math/Vector3i.cs | 2 +- math/Vector4d.cs | 2 +- math/Vector4f.cs | 2 +- math/VectorTuple.cs | 12 +++--- mesh/DMesh3.cs | 8 ++-- mesh/DMesh3Builder.cs | 4 +- mesh/DMesh3Changes.cs | 8 ++-- mesh/DMesh3_edge_operators.cs | 10 ++--- mesh/DSubmesh3.cs | 2 +- mesh/DSubmesh3Set.cs | 2 +- mesh/EdgeLoop.cs | 2 +- mesh/EdgeLoopRemesher.cs | 2 +- mesh/EdgeSpan.cs | 2 +- mesh/FaceGroupOptimizer.cs | 2 +- mesh/IMesh.cs | 2 +- mesh/MeshCaches.cs | 2 +- mesh/MeshConstraints.cs | 8 ++-- mesh/MeshDecomposition.cs | 4 +- mesh/MeshEditor.cs | 4 +- mesh/MeshMeasurements.cs | 2 +- mesh/MeshNormals.cs | 4 +- mesh/MeshPointSets.cs | 4 +- mesh/MeshRefinerBase.cs | 2 +- mesh/MeshUVSet.cs | 2 +- mesh/NTMesh3.cs | 4 +- mesh/Reducer.cs | 4 +- mesh/RegionRemesher.cs | 4 +- mesh/Remesher.cs | 6 +-- mesh/RemesherPro.cs | 2 +- mesh/SimpleMesh.cs | 4 +- mesh/SimpleQuadMesh.cs | 2 +- mesh_generators/ArrowGenerators.cs | 2 +- mesh_generators/BoxGenerators.cs | 4 +- mesh_generators/CylinderGenerators.cs | 8 ++-- mesh_generators/DiscGenerators.cs | 4 +- mesh_generators/GenCylGenerators.cs | 2 +- mesh_generators/MarchingCubes.cs | 4 +- mesh_generators/MarchingCubesPro.cs | 4 +- mesh_generators/PlaneGenerators.cs | 12 +++--- mesh_generators/PointsMeshGenerators.cs | 2 +- mesh_generators/RevolveGenerator.cs | 4 +- mesh_generators/SphereGenerators.cs | 4 +- .../TriangulatedPolygonGenerator.cs | 2 +- mesh_generators/VoxelSurfaceGenerator.cs | 2 +- mesh_ops/AutoHoleFill.cs | 2 +- mesh_ops/LaplacianMeshDeformer.cs | 4 +- mesh_ops/LaplacianMeshSmoother.cs | 4 +- mesh_ops/MergeCoincidentEdges.cs | 2 +- mesh_ops/MeshAssembly.cs | 2 +- mesh_ops/MeshAutoRepair.cs | 4 +- mesh_ops/MeshBoolean.cs | 2 +- mesh_ops/MeshExtrudeFaces.cs | 2 +- mesh_ops/MeshExtrudeLoop.cs | 2 +- mesh_ops/MeshExtrudeMesh.cs | 2 +- mesh_ops/MeshICP.cs | 2 +- mesh_ops/MeshInsertPolygon.cs | 2 +- mesh_ops/MeshInsertProjectedPolygon.cs | 2 +- mesh_ops/MeshInsertUVPolyCurve.cs | 2 +- mesh_ops/MeshIsoCurves.cs | 8 ++-- mesh_ops/MeshIterativeSmooth.cs | 2 +- mesh_ops/MeshLocalParam.cs | 4 +- mesh_ops/MeshLoopClosure.cs | 2 +- mesh_ops/MeshLoopSmooth.cs | 2 +- mesh_ops/MeshMeshCut.cs | 2 +- mesh_ops/MeshOps.cs | 4 +- mesh_ops/MeshPlaneCut.cs | 2 +- mesh_ops/MeshRepairOrientation.cs | 2 +- mesh_ops/MeshSpatialSort.cs | 6 +-- mesh_ops/MeshStitchLoops.cs | 2 +- mesh_ops/MeshTopology.cs | 2 +- mesh_ops/MeshTrimLoop.cs | 2 +- mesh_ops/MinimalHoleFill.cs | 2 +- mesh_ops/PlanarHoleFiller.cs | 2 +- mesh_ops/PlanarSpansFiller.cs | 2 +- mesh_ops/RegionOperator.cs | 2 +- mesh_ops/RemoveDuplicateTriangles.cs | 2 +- mesh_ops/RemoveOccludedTriangles.cs | 4 +- mesh_ops/SimpleHoleFiller.cs | 2 +- mesh_ops/SmoothedHoleFill.cs | 2 +- mesh_selection/MeshBoundaryLoops.cs | 8 ++-- mesh_selection/MeshConnectedComponents.cs | 4 +- mesh_selection/MeshEdgeSelection.cs | 2 +- mesh_selection/MeshFaceSelection.cs | 2 +- mesh_selection/MeshFacesFromLoop.cs | 2 +- mesh_selection/MeshRegionBoundaryLoops.cs | 2 +- mesh_selection/MeshVertexSelection.cs | 2 +- queries/IntersectionUtil.cs | 6 +-- queries/MeshValidation.cs | 2 +- queries/RayIntersection.cs | 2 +- shapes3/Circle3.cs | 2 +- shapes3/Cylinder3.cs | 2 +- solvers/CholeskyDecomposition.cs | 2 +- solvers/DenseMatrix.cs | 2 +- solvers/DenseVector.cs | 2 +- solvers/FastQuaternionSVD.cs | 2 +- solvers/PackedSparseMatrix.cs | 8 ++-- solvers/SingularValueDecomposition.cs | 2 +- solvers/SparseMatrix.cs | 4 +- solvers/SparseSymmetricCG.cs | 4 +- solvers/SymmetricEigenSolver.cs | 4 +- spatial/BasicIntersectionTargets.cs | 6 +-- spatial/BasicProjectionTargets.cs | 12 +++--- spatial/BiGrid3.cs | 2 +- spatial/Bitmap2.cs | 2 +- spatial/Bitmap3.cs | 2 +- spatial/DCurveBoxTree.cs | 2 +- spatial/DCurveProjection.cs | 2 +- spatial/DMeshAABBTree.cs | 14 +++---- spatial/DSparseGrid3.cs | 2 +- spatial/DenseGrid2.cs | 4 +- spatial/DenseGrid3.cs | 4 +- spatial/EditMeshSpatial.cs | 2 +- spatial/GridIndexing.cs | 10 ++--- spatial/GridIndexing2.cs | 8 ++-- spatial/MeshScalarSamplingGrid.cs | 4 +- spatial/MeshSignedDistanceGrid.cs | 6 +-- spatial/MeshWindingNumberGrid.cs | 4 +- spatial/NormalHistogram.cs | 2 +- spatial/PointAABBTree3.cs | 6 +-- spatial/PointHashGrid2d.cs | 2 +- spatial/PointHashGrid3d.cs | 2 +- spatial/PointSetHashtable.cs | 4 +- spatial/Polygon2dBoxTree.cs | 4 +- spatial/SegmentHashGrid.cs | 2 +- spatial/SegmentSet2d.cs | 2 +- spatial/SpatialFunctions.cs | 2 +- spatial/TriangleBinsGrid2d.cs | 2 +- 284 files changed, 501 insertions(+), 501 deletions(-) diff --git a/approximation/BiArcFit2.cs b/approximation/BiArcFit2.cs index 6857b486..f3e82e5b 100644 --- a/approximation/BiArcFit2.cs +++ b/approximation/BiArcFit2.cs @@ -9,7 +9,7 @@ namespace g3 // 2D Biarc fitting ported from http://www.ryanjuckett.com/programming/biarc-interpolation/ // // - public class BiArcFit2 + [Serializable] public class BiArcFit2 { public Vector2d Point1; public Vector2d Point2; diff --git a/approximation/GaussPointsFit3.cs b/approximation/GaussPointsFit3.cs index 0f66cbb4..422cc3a2 100644 --- a/approximation/GaussPointsFit3.cs +++ b/approximation/GaussPointsFit3.cs @@ -9,7 +9,7 @@ namespace g3 // extents are the eigenvalues of the covariance matrix and are returned in // increasing order. The quantites are stored in a Box3 just to have a // single container. - public class GaussPointsFit3 + [Serializable] public class GaussPointsFit3 { public Box3d Box; public bool ResultValid = false; diff --git a/approximation/OrthogonalPlaneFit3.cs b/approximation/OrthogonalPlaneFit3.cs index 8714beb9..15422c38 100644 --- a/approximation/OrthogonalPlaneFit3.cs +++ b/approximation/OrthogonalPlaneFit3.cs @@ -6,7 +6,7 @@ namespace g3 // Ported from WildMagic5 Wm5ApprPlaneFit3 // Least-squares fit of a plane to (x,y,z) data by using distance measurements // orthogonal to the proposed plane. - public class OrthogonalPlaneFit3 + [Serializable] public class OrthogonalPlaneFit3 { public Vector3d Origin; public Vector3d Normal; diff --git a/color/ColorHSV.cs b/color/ColorHSV.cs index d9e64882..7bd5a535 100644 --- a/color/ColorHSV.cs +++ b/color/ColorHSV.cs @@ -5,7 +5,7 @@ namespace g3 { - public class ColorHSV + [Serializable] public class ColorHSV { public float h; public float s; diff --git a/color/ColorMap.cs b/color/ColorMap.cs index 1abb6900..b2f23254 100644 --- a/color/ColorMap.cs +++ b/color/ColorMap.cs @@ -3,7 +3,7 @@ namespace g3 { - public class ColorMap + [Serializable] public class ColorMap { struct ColorPoint { diff --git a/color/Colorb.cs b/color/Colorb.cs index 4db89127..ea440518 100644 --- a/color/Colorb.cs +++ b/color/Colorb.cs @@ -6,7 +6,7 @@ namespace g3 { - public struct Colorb + [Serializable] public struct Colorb { public byte r; public byte g; diff --git a/color/Colorf.cs b/color/Colorf.cs index b113bb4e..2f2bac65 100644 --- a/color/Colorf.cs +++ b/color/Colorf.cs @@ -8,7 +8,7 @@ namespace g3 { - public struct Colorf : IComparable, IEquatable + [Serializable] public struct Colorf : IComparable, IEquatable { public float r; public float g; diff --git a/comp_geom/Arrangement2d.cs b/comp_geom/Arrangement2d.cs index 941aebeb..e00d6d49 100644 --- a/comp_geom/Arrangement2d.cs +++ b/comp_geom/Arrangement2d.cs @@ -18,7 +18,7 @@ namespace g3 /// [TODO] maybe smarter handling /// /// - public class Arrangement2d + [Serializable] public class Arrangement2d { // graph of arrangement public DGraph2 Graph; diff --git a/comp_geom/ConvexHull2.cs b/comp_geom/ConvexHull2.cs index cd3257ac..6d8219c5 100644 --- a/comp_geom/ConvexHull2.cs +++ b/comp_geom/ConvexHull2.cs @@ -26,7 +26,7 @@ namespace g3 /// /// HullIndices provides ordered indices of vertices of input points that form hull. /// - public class ConvexHull2 + [Serializable] public class ConvexHull2 { //QueryNumberType mQueryType = QueryNumberType.QT_DOUBLE; IList mVertices; diff --git a/comp_geom/GraphCells2d.cs b/comp_geom/GraphCells2d.cs index e4c794d6..85b610d0 100644 --- a/comp_geom/GraphCells2d.cs +++ b/comp_geom/GraphCells2d.cs @@ -17,7 +17,7 @@ namespace g3 /// oriented clockwise, if converted to a Polygon2d. /// /// - public class GraphCells2d + [Serializable] public class GraphCells2d { public DGraph2 Graph; diff --git a/comp_geom/GraphSplitter2d.cs b/comp_geom/GraphSplitter2d.cs index c212be1f..61a933e8 100644 --- a/comp_geom/GraphSplitter2d.cs +++ b/comp_geom/GraphSplitter2d.cs @@ -15,7 +15,7 @@ namespace g3 /// - computation of signs for a split-line is currently O(N). If inserting many /// parallel lines, can improve this using standard sorting. /// - public class GraphSplitter2d + [Serializable] public class GraphSplitter2d { public DGraph2 Graph; diff --git a/comp_geom/SphericalFibonacciPointSet.cs b/comp_geom/SphericalFibonacciPointSet.cs index fe9e8015..6e663bf1 100644 --- a/comp_geom/SphericalFibonacciPointSet.cs +++ b/comp_geom/SphericalFibonacciPointSet.cs @@ -15,7 +15,7 @@ namespace g3 /// /// math from http://lgdv.cs.fau.de/uploads/publications/spherical_fibonacci_mapping_opt.pdf /// - public class SphericalFibonacciPointSet + [Serializable] public class SphericalFibonacciPointSet { public int N = 64; diff --git a/containment/ContBox3.cs b/containment/ContBox3.cs index a43d5871..019b4cdc 100644 --- a/containment/ContBox3.cs +++ b/containment/ContBox3.cs @@ -9,7 +9,7 @@ namespace g3 // ported from GTEngine GteContOrientedBox3.h // (2017) url: https://www.geometrictools.com/GTEngine/Include/Mathematics/GteContOrientedBox3.h - public class ContOrientedBox3 + [Serializable] public class ContOrientedBox3 { public Box3d Box; public bool ResultValid = false; diff --git a/containment/ContMinBox2.cs b/containment/ContMinBox2.cs index 80726c09..fdaf12c2 100644 --- a/containment/ContMinBox2.cs +++ b/containment/ContMinBox2.cs @@ -15,7 +15,7 @@ namespace g3 /// /// Fit minimal bounding-box to a set of 2D points. Result is in MinBox. /// - public class ContMinBox2 + [Serializable] public class ContMinBox2 { Box2d mMinBox; diff --git a/containment/ContMinCircle2.cs b/containment/ContMinCircle2.cs index 6b155afc..7a60971f 100644 --- a/containment/ContMinCircle2.cs +++ b/containment/ContMinCircle2.cs @@ -14,7 +14,7 @@ namespace g3 /// /// Fit minimal bounding-circle to a set of 2D points /// - public class ContMinCircle2 + [Serializable] public class ContMinCircle2 { double mEpsilon; Func[] mUpdate = new Func[4]; diff --git a/core/BufferUtil.cs b/core/BufferUtil.cs index 59bba42b..3ca17c8e 100644 --- a/core/BufferUtil.cs +++ b/core/BufferUtil.cs @@ -14,7 +14,7 @@ namespace g3 /// - byte[] conversions /// - zlib compress/decompress byte[] buffers /// - public class BufferUtil + [Serializable] public class BufferUtil { static public void SetVertex3(double[] v, int i, double x, double y, double z) { v[3 * i] = x; @@ -561,7 +561,7 @@ static public byte[] DecompressZLib(byte[] zBuffer) /// T * ptr = &array[i]; /// ptr[k] = value /// - public struct ArrayAlias + [Serializable] public struct ArrayAlias { public T[] Source; public int Index; diff --git a/core/CommandArgumentSet.cs b/core/CommandArgumentSet.cs index 12a40104..60d718d9 100644 --- a/core/CommandArgumentSet.cs +++ b/core/CommandArgumentSet.cs @@ -7,7 +7,7 @@ namespace g3 { // this is a utility class for parsing command-line arguments, but can // also be used for other things (eg like constructing command-line arguments!) - public class CommandArgumentSet + [Serializable] public class CommandArgumentSet { // expectation is that these arguments will appear as like // -samples 7 or -output /some/kind/of/path diff --git a/core/DVector.cs b/core/DVector.cs index fcda514e..d14eb955 100644 --- a/core/DVector.cs +++ b/core/DVector.cs @@ -11,7 +11,7 @@ namespace g3 // - this[] operator does not check bounds, so it can write to any valid Block // - some fns discard Blocks beyond iCurBlock // - wtf... - public class DVector : IEnumerable + [Serializable] public class DVector : IEnumerable { List Blocks; int iCurBlock; @@ -408,7 +408,7 @@ IEnumerator IEnumerable.GetEnumerator() { // block iterator - public struct DBlock + [Serializable] public struct DBlock { public T[] data; public int usedCount; diff --git a/core/DVectorArray.cs b/core/DVectorArray.cs index 0667a5fa..f4e05d6f 100644 --- a/core/DVectorArray.cs +++ b/core/DVectorArray.cs @@ -10,7 +10,7 @@ namespace g3 // This class is just a wrapper around a dvector that provides convenient 3-element set/get access // Useful for things like treating a float array as a list of vectors // - public class DVectorArray3 : IEnumerable + [Serializable] public class DVectorArray3 : IEnumerable { public DVector vector; @@ -67,7 +67,7 @@ IEnumerator IEnumerable.GetEnumerator() } - public class DVectorArray3d : DVectorArray3 + [Serializable] public class DVectorArray3d : DVectorArray3 { const double invalid_value = -99999999.0; @@ -87,7 +87,7 @@ public IEnumerable AsVector3d() { }; - public class DVectorArray3f : DVectorArray3 + [Serializable] public class DVectorArray3f : DVectorArray3 { public DVectorArray3f(int nCount = 0) : base(nCount) { } public DVectorArray3f(float[] data) : base(data) { } @@ -104,7 +104,7 @@ public IEnumerable AsVector3f() }; - public class DVectorArray3i : DVectorArray3 + [Serializable] public class DVectorArray3i : DVectorArray3 { public DVectorArray3i(int nCount = 0) : base(nCount) { } public DVectorArray3i(int[] data) : base(data) { } @@ -133,7 +133,7 @@ public IEnumerable AsVector3i() - public class DIndexArray3i : DVectorArray3 + [Serializable] public class DIndexArray3i : DVectorArray3 { public DIndexArray3i(int nCount = 0) : base(nCount) { } public DIndexArray3i(int[] data) : base(data) { } @@ -167,7 +167,7 @@ public IEnumerable AsIndex3i() // // Same as DVectorArray3, but for 2D vectors/etc // - public class DVectorArray2 : IEnumerable + [Serializable] public class DVectorArray2 : IEnumerable { public DVector vector; @@ -217,7 +217,7 @@ IEnumerator IEnumerable.GetEnumerator() return this.GetEnumerator(); } } - public class DVectorArray2d : DVectorArray2 + [Serializable] public class DVectorArray2d : DVectorArray2 { public DVectorArray2d(int nCount = 0) : base(nCount) { } public DVectorArray2d(double[] data) : base(data) { } @@ -231,7 +231,7 @@ public IEnumerable AsVector2d() { yield return this[i]; } }; - public class DVectorArray2f : DVectorArray2 + [Serializable] public class DVectorArray2f : DVectorArray2 { public DVectorArray2f(int nCount = 0) : base(nCount) { } public DVectorArray2f(float[] data) : base(data) { } @@ -248,7 +248,7 @@ public IEnumerable AsVector2f() { - public class DIndexArray2i : DVectorArray2 + [Serializable] public class DIndexArray2i : DVectorArray2 { public DIndexArray2i(int nCount = 0) : base(nCount) { } public DIndexArray2i(int[] data) : base(data) { } diff --git a/core/DijkstraGraphDistance.cs b/core/DijkstraGraphDistance.cs index 63bf25b5..cfab0415 100644 --- a/core/DijkstraGraphDistance.cs +++ b/core/DijkstraGraphDistance.cs @@ -17,7 +17,7 @@ namespace g3 /// - MeshVertices(mesh) - compute on vertices of mesh /// /// - public class DijkstraGraphDistance + [Serializable] public class DijkstraGraphDistance { public const float InvalidValue = float.MaxValue; diff --git a/core/DynamicPriorityQueue.cs b/core/DynamicPriorityQueue.cs index f066952e..6c89d38f 100644 --- a/core/DynamicPriorityQueue.cs +++ b/core/DynamicPriorityQueue.cs @@ -33,7 +33,7 @@ public abstract class DynamicPriorityQueueNode /// /// conceptually based on https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp /// - public class DynamicPriorityQueue : IEnumerable + [Serializable] public class DynamicPriorityQueue : IEnumerable where T : DynamicPriorityQueueNode { // set this to true during development to catch issues diff --git a/core/HBitArray.cs b/core/HBitArray.cs index 60439315..999916ca 100644 --- a/core/HBitArray.cs +++ b/core/HBitArray.cs @@ -16,7 +16,7 @@ namespace g3 /// Uses more memory than BitArray, but each tree level is divided by 32, so /// it is better than NlogN /// - public class HBitArray : IEnumerable + [Serializable] public class HBitArray : IEnumerable { struct MyBitVector32 { diff --git a/core/HashUtil.cs b/core/HashUtil.cs index ea0e3de5..6117fc17 100644 --- a/core/HashUtil.cs +++ b/core/HashUtil.cs @@ -9,7 +9,7 @@ namespace g3 /// /// (should probably be using uint? but standard GetHashCode() returns int...) /// - public struct HashBuilder + [Serializable] public struct HashBuilder { public int Hash; diff --git a/core/IndexPriorityQueue.cs b/core/IndexPriorityQueue.cs index 059c965f..6f545ee8 100644 --- a/core/IndexPriorityQueue.cs +++ b/core/IndexPriorityQueue.cs @@ -17,7 +17,7 @@ namespace g3 /// /// conceptually based on https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp /// - public class IndexPriorityQueue : IEnumerable + [Serializable] public class IndexPriorityQueue : IEnumerable { // set this to true during development to catch issues public bool EnableDebugChecks = false; diff --git a/core/Indexing.cs b/core/Indexing.cs index a6f89916..56216521 100644 --- a/core/Indexing.cs +++ b/core/Indexing.cs @@ -8,7 +8,7 @@ namespace g3 // An enumerator that enumerates over integers [start, start+count) // (useful when you need to do things like iterate over indices of an array rather than values) - public class IndexRangeEnumerator : IEnumerable + [Serializable] public class IndexRangeEnumerator : IEnumerable { int Start = 0; int Count = 0; @@ -27,7 +27,7 @@ IEnumerator IEnumerable.GetEnumerator() { // Add true/false operator[] to integer HashSet - public class IndexHashSet : HashSet + [Serializable] public class IndexHashSet : HashSet { public bool this[int key] { @@ -51,7 +51,7 @@ public bool this[int key] /// use a HashSet (or perhaps some other DS) if the fraction of the index space /// required is small /// - public class IndexFlagSet : IEnumerable + [Serializable] public class IndexFlagSet : IEnumerable { BitArray bits; HashSet hash; @@ -165,7 +165,7 @@ public interface IIndexMap // i = i index map - public class IdentityIndexMap : IIndexMap + [Serializable] public class IdentityIndexMap : IIndexMap { public int this[int index] { get { return index; } @@ -174,7 +174,7 @@ public int this[int index] { // i = i + constant index map - public class ShiftIndexMap : IIndexMap + [Serializable] public class ShiftIndexMap : IIndexMap { public int Shift; @@ -189,7 +189,7 @@ public int this[int index] { // i = constant index map - public class ConstantIndexMap : IIndexMap + [Serializable] public class ConstantIndexMap : IIndexMap { public int Constant; @@ -205,7 +205,7 @@ public int this[int index] { // dense or sparse index map - public class IndexMap : IIndexMap + [Serializable] public class IndexMap : IIndexMap { // this is returned if sparse map doesn't contain value public readonly int InvalidIndex = int.MinValue; diff --git a/core/MemoryPool.cs b/core/MemoryPool.cs index cecbe3c4..8d2fb15c 100644 --- a/core/MemoryPool.cs +++ b/core/MemoryPool.cs @@ -6,7 +6,7 @@ namespace g3 /// /// Very basic object pool class. /// - public class MemoryPool where T : class, new() + [Serializable] public class MemoryPool where T : class, new() { DVector Allocated; DVector Free; diff --git a/core/ProfileUtil.cs b/core/ProfileUtil.cs index 87d4e4a6..a75b1bcb 100644 --- a/core/ProfileUtil.cs +++ b/core/ProfileUtil.cs @@ -7,7 +7,7 @@ namespace g3 { - public class BlockTimer + [Serializable] public class BlockTimer { public Stopwatch Watch; public string Label; @@ -71,7 +71,7 @@ public static string TimeFormatString(TimeSpan span) - public class LocalProfiler : IDisposable + [Serializable] public class LocalProfiler : IDisposable { Dictionary Timers = new Dictionary(); List Order = new List(); diff --git a/core/ProgressCancel.cs b/core/ProgressCancel.cs index 0a831229..69a706f8 100644 --- a/core/ProgressCancel.cs +++ b/core/ProgressCancel.cs @@ -14,7 +14,7 @@ public interface ICancelSource /// /// Just wraps a func as an ICancelSource /// - public class CancelFunction : ICancelSource + [Serializable] public class CancelFunction : ICancelSource { public Func CancelF; public CancelFunction(Func cancelF) { @@ -29,7 +29,7 @@ public CancelFunction(Func cancelF) { /// 1) provide progress info back to caller (not implemented yet) /// 2) allow caller to cancel the computation /// - public class ProgressCancel + [Serializable] public class ProgressCancel { public ICancelSource Source; diff --git a/core/RefCountVector.cs b/core/RefCountVector.cs index a8ac5b85..0023c2df 100644 --- a/core/RefCountVector.cs +++ b/core/RefCountVector.cs @@ -14,7 +14,7 @@ namespace g3 /// No overflow checking is done in release builds. /// /// - public class RefCountVector : System.Collections.IEnumerable + [Serializable] public class RefCountVector : System.Collections.IEnumerable { public static readonly short invalid = -1; diff --git a/core/SafeCollections.cs b/core/SafeCollections.cs index 947054f3..95ba021a 100644 --- a/core/SafeCollections.cs +++ b/core/SafeCollections.cs @@ -11,7 +11,7 @@ namespace g3 /// A simple wrapper around a List that supports multi-threaded construction. /// Basically intended for use within things like a Parallel.ForEach /// - public class SafeListBuilder + [Serializable] public class SafeListBuilder { public List List; public SpinLock spinlock; diff --git a/core/SmallListSet.cs b/core/SmallListSet.cs index 568eb4e0..56e42f03 100644 --- a/core/SmallListSet.cs +++ b/core/SmallListSet.cs @@ -15,7 +15,7 @@ namespace g3 /// Each list stores its count, so list-size operations are constant time. /// All the internal "pointers" are 32-bit. /// - public class SmallListSet + [Serializable] public class SmallListSet { const int Null = -1; diff --git a/core/Snapping.cs b/core/Snapping.cs index e7c04eb5..32dde4ac 100644 --- a/core/Snapping.cs +++ b/core/Snapping.cs @@ -2,7 +2,7 @@ namespace g3 { - public class Snapping + [Serializable] public class Snapping { public static double SnapToIncrement(double fValue, double fIncrement, double offset = 0) diff --git a/core/SparseList.cs b/core/SparseList.cs index 421ac375..42b19cf5 100644 --- a/core/SparseList.cs +++ b/core/SparseList.cs @@ -12,7 +12,7 @@ namespace g3 /// /// Currently uses Dictionary<> as sparse data structure /// - public class SparseList where T : IEquatable + [Serializable] public class SparseList where T : IEquatable { T[] dense; Dictionary sparse; @@ -115,7 +115,7 @@ public IEnumerable> NonZeroValues() /// /// TODO: can we combine these classes somehow? /// - public class SparseObjectList where T : class + [Serializable] public class SparseObjectList where T : class { T[] dense; Dictionary sparse; diff --git a/core/TagSet.cs b/core/TagSet.cs index a9d3b38e..fb05b677 100644 --- a/core/TagSet.cs +++ b/core/TagSet.cs @@ -7,7 +7,7 @@ namespace g3 /// /// Basic object->integer mapping /// - public class IntTagSet + [Serializable] public class IntTagSet { public const int InvalidTag = int.MaxValue; @@ -46,7 +46,7 @@ public int Get(T reference) /// /// integer type/value pair, packed into 32 bits - 8 for type, 24 for value /// - public struct IntTagPair + [Serializable] public struct IntTagPair { public byte type; public int value; @@ -69,7 +69,7 @@ public IntTagPair(int combined) /// /// Basic object->string mapping /// - public class StringTagSet + [Serializable] public class StringTagSet { public const string InvalidTag = ""; diff --git a/core/Util.cs b/core/Util.cs index 02e9121a..eecdaa39 100644 --- a/core/Util.cs +++ b/core/Util.cs @@ -9,7 +9,7 @@ namespace g3 { - public enum FailMode { DebugAssert, gDevAssert, Throw, ReturnOnly } + [Serializable] public enum FailMode { DebugAssert, gDevAssert, Throw, ReturnOnly } public static class Util @@ -272,7 +272,7 @@ public static void WriteDebugMeshAndMarkers(IMesh mesh, List Markers, - public class gException : Exception + [Serializable] public class gException : Exception { public gException(string sMessage) : base(sMessage) diff --git a/core/VectorArray.cs b/core/VectorArray.cs index 1c66e186..6d00de40 100644 --- a/core/VectorArray.cs +++ b/core/VectorArray.cs @@ -10,7 +10,7 @@ namespace g3 // This class is just a wrapper around a static array that provides convenient 3-element set/get access // Useful for things like treating a float array as a list of vectors // - public class VectorArray3 : IEnumerable + [Serializable] public class VectorArray3 : IEnumerable { public T[] array; @@ -56,7 +56,7 @@ IEnumerator IEnumerable.GetEnumerator() } - public class VectorArray3d : VectorArray3 + [Serializable] public class VectorArray3d : VectorArray3 { const double invalid_value = -99999999.0; @@ -92,7 +92,7 @@ public IEnumerable AsVector3d() }; - public class VectorArray3f : VectorArray3 + [Serializable] public class VectorArray3f : VectorArray3 { public VectorArray3f(int nCount) : base(nCount) { } public VectorArray3f(float[] data) : base(data) { } @@ -109,7 +109,7 @@ public IEnumerable AsVector3f() }; - public class VectorArray3i : VectorArray3 + [Serializable] public class VectorArray3i : VectorArray3 { public VectorArray3i(int nCount) : base(nCount) { } public VectorArray3i(int[] data) : base(data) { } @@ -138,7 +138,7 @@ public IEnumerable AsVector3i() - public class IndexArray3i : VectorArray3 + [Serializable] public class IndexArray3i : VectorArray3 { public IndexArray3i(int nCount) : base(nCount) { } public IndexArray3i(int[] data) : base(data) { } @@ -172,7 +172,7 @@ public IEnumerable AsIndex3i() // // Same as VectorArray3, but for 2D vectors/etc // - public class VectorArray2 : IEnumerable + [Serializable] public class VectorArray2 : IEnumerable { public T[] array; @@ -217,7 +217,7 @@ IEnumerator IEnumerable.GetEnumerator() return array.GetEnumerator(); } } - public class VectorArray2d : VectorArray2 + [Serializable] public class VectorArray2d : VectorArray2 { public VectorArray2d(int nCount) : base(nCount) { } public VectorArray2d(double[] data) : base(data) { } @@ -231,7 +231,7 @@ public IEnumerable AsVector2d() { yield return this[i]; } }; - public class VectorArray2f : VectorArray2 + [Serializable] public class VectorArray2f : VectorArray2 { public VectorArray2f(int nCount) : base(nCount) { } public VectorArray2f(float[] data) : base(data) { } @@ -248,7 +248,7 @@ public IEnumerable AsVector2f() { - public class IndexArray2i : VectorArray2 + [Serializable] public class IndexArray2i : VectorArray2 { public IndexArray2i(int nCount) : base(nCount) { } public IndexArray2i(int[] data) : base(data) { } @@ -273,7 +273,7 @@ public IEnumerable AsIndex2i() { - public class VectorArray4 : IEnumerable + [Serializable] public class VectorArray4 : IEnumerable { public T[] array; @@ -324,7 +324,7 @@ IEnumerator IEnumerable.GetEnumerator() - public class IndexArray4i : VectorArray4 + [Serializable] public class IndexArray4i : VectorArray4 { public IndexArray4i(int nCount) : base(nCount) { } public IndexArray4i(int[] data) : base(data) { } diff --git a/core/g3Iterators.cs b/core/g3Iterators.cs index 6bbc8230..94f80f2d 100644 --- a/core/g3Iterators.cs +++ b/core/g3Iterators.cs @@ -12,7 +12,7 @@ namespace g3 /// /// Iterator that just returns a constant value N times /// - public class ConstantItr : IEnumerable + [Serializable] public class ConstantItr : IEnumerable { public T ConstantValue = default(T); public int N; @@ -31,7 +31,7 @@ public IEnumerator GetEnumerator() { /// /// Iterator that re-maps iterated values via a Func /// - public class RemapItr : IEnumerable + [Serializable] public class RemapItr : IEnumerable { public IEnumerable OtherItr; public Func ValueF; @@ -52,7 +52,7 @@ public IEnumerator GetEnumerator() { /// /// IList wrapper that remaps values via a Func (eg for index maps) /// - public class MappedList : IList + [Serializable] public class MappedList : IList { public IList BaseList; public Func MapF = (i) => { return i; }; @@ -98,7 +98,7 @@ IEnumerator IEnumerable.GetEnumerator() /// /// IList wrapper for an Interval1i, ie sequential list of integers /// - public struct IntSequence : IList + [Serializable] public struct IntSequence : IList { Interval1i range; diff --git a/core/gParallel.cs b/core/gParallel.cs index 53b4aa6b..505c1f2b 100644 --- a/core/gParallel.cs +++ b/core/gParallel.cs @@ -10,7 +10,7 @@ namespace g3 { - public class gParallel + [Serializable] public class gParallel { public static void ForEach_Sequential(IEnumerable source, Action body) @@ -148,7 +148,7 @@ static void for_each( IEnumerable source, Action body ) // // Perhaps an alternative would be to use a fixed buffer of T? // However, if T is a class (eg by-reference), then this doesn't help as they still have to be allocated.... - public class ParallelStream + [Serializable] public class ParallelStream { public Func ProducerF = null; //public List> Operators = new List>(); @@ -232,7 +232,7 @@ void ConsumerThreadFunc() // locking queue - provides thread-safe sequential add/remove/count to Queue - public class LockingQueue + [Serializable] public class LockingQueue { Queue queue; object queue_lock; @@ -282,7 +282,7 @@ public int Count { * Note that this is class and SpinLock is a struct, so this may cause * disasters, but at least things build... */ - public class SpinLock + [Serializable] public class SpinLock { object o; public SpinLock() diff --git a/curve/Arc2.cs b/curve/Arc2.cs index 10da9f95..7aaa78ac 100644 --- a/curve/Arc2.cs +++ b/curve/Arc2.cs @@ -6,7 +6,7 @@ namespace g3 { - public class Arc2d : IParametricCurve2d + [Serializable] public class Arc2d : IParametricCurve2d { public Vector2d Center; public double Radius; diff --git a/curve/ArcLengthParam.cs b/curve/ArcLengthParam.cs index 633cb108..2a5509ee 100644 --- a/curve/ArcLengthParam.cs +++ b/curve/ArcLengthParam.cs @@ -4,7 +4,7 @@ namespace g3 { - public struct CurveSample + [Serializable] public struct CurveSample { public Vector3d position; public Vector3d tangent; @@ -21,7 +21,7 @@ public interface IArcLengthParam - public class SampledArcLengthParam : IArcLengthParam + [Serializable] public class SampledArcLengthParam : IArcLengthParam { double[] arc_len; Vector3d[] positions; @@ -97,7 +97,7 @@ protected Vector3d tangent(int i) - public struct CurveSample2d + [Serializable] public struct CurveSample2d { public Vector2d position; public Vector2d tangent; @@ -115,7 +115,7 @@ public interface IArcLengthParam2d } - public class SampledArcLengthParam2d : IArcLengthParam2d + [Serializable] public class SampledArcLengthParam2d : IArcLengthParam2d { double[] arc_len; Vector2d[] positions; diff --git a/curve/BSplineBasis.cs b/curve/BSplineBasis.cs index 8e9d040c..68c80191 100644 --- a/curve/BSplineBasis.cs +++ b/curve/BSplineBasis.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 BSplineBasis - public class BSplineBasis + [Serializable] public class BSplineBasis { // Defaultructor. The number of control points is n+1 and the // indices i for the control points satisfy 0 <= i <= n. The degree of diff --git a/curve/BezierCurve2.cs b/curve/BezierCurve2.cs index 0444f77b..413dc98b 100644 --- a/curve/BezierCurve2.cs +++ b/curve/BezierCurve2.cs @@ -9,7 +9,7 @@ namespace g3 /// 2D Bezier curve of arbitrary degree /// Ported from WildMagic5 Wm5BezierCurve2 /// - public class BezierCurve2 : BaseCurve2, IParametricCurve2d + [Serializable] public class BezierCurve2 : BaseCurve2, IParametricCurve2d { int mDegree; int mNumCtrlPoints; diff --git a/curve/Circle2.cs b/curve/Circle2.cs index 3cab0789..ff83713a 100644 --- a/curve/Circle2.cs +++ b/curve/Circle2.cs @@ -2,7 +2,7 @@ namespace g3 { - public class Circle2d : IParametricCurve2d + [Serializable] public class Circle2d : IParametricCurve2d { public Vector2d Center; public double Radius; diff --git a/curve/CurveResampler.cs b/curve/CurveResampler.cs index a4934f53..0a3477c4 100644 --- a/curve/CurveResampler.cs +++ b/curve/CurveResampler.cs @@ -5,7 +5,7 @@ namespace g3 { - public class CurveResampler + [Serializable] public class CurveResampler { double[] lengths; diff --git a/curve/CurveUtils.cs b/curve/CurveUtils.cs index bc5a9db5..a9d4ff04 100644 --- a/curve/CurveUtils.cs +++ b/curve/CurveUtils.cs @@ -5,7 +5,7 @@ namespace g3 { - public class CurveUtils + [Serializable] public class CurveUtils { public static Vector3d GetTangent(List vertices, int i, bool bLoop = false) @@ -205,7 +205,7 @@ public static void IterativeSmooth(IList vertices, int iStart, int iEn /// /// Simple sampled-curve wrapper type /// - public class IWrappedCurve3d : ISampledCurve3d + [Serializable] public class IWrappedCurve3d : ISampledCurve3d { public IList VertexList; public bool Closed { get; set; } diff --git a/curve/DCurve3.cs b/curve/DCurve3.cs index 2eb8a2a4..3a7524a8 100644 --- a/curve/DCurve3.cs +++ b/curve/DCurve3.cs @@ -9,7 +9,7 @@ namespace g3 /// DCurve3 is a 3D polyline, either open or closed (via .Closed) /// Despite the D prefix, it is *not* dynamic /// - public class DCurve3 : ISampledCurve3d + [Serializable] public class DCurve3 : ISampledCurve3d { // [TODO] use dvector? or double-indirection indexing? // question is how to insert efficiently... diff --git a/curve/DGraph.cs b/curve/DGraph.cs index 75e4363e..19551b3d 100644 --- a/curve/DGraph.cs +++ b/curve/DGraph.cs @@ -336,7 +336,7 @@ public MeshResult RemoveVertex(int vid, bool bRemoveIsolatedVertices) - public struct EdgeSplitInfo + [Serializable] public struct EdgeSplitInfo { public int vNew; public int eNewBN; // new edge [vNew,vB] (original was AB) @@ -391,7 +391,7 @@ protected virtual int append_new_split_vertex(int a, int b) - public struct EdgeCollapseInfo + [Serializable] public struct EdgeCollapseInfo { public int vKept; public int vRemoved; @@ -531,7 +531,7 @@ public bool IsRegularVertex(int vID) { - public enum FailMode { DebugAssert, gDevAssert, Throw, ReturnOnly } + [Serializable] public enum FailMode { DebugAssert, gDevAssert, Throw, ReturnOnly } /// // This function checks that the graph is well-formed, ie all internal data @@ -634,7 +634,7 @@ public void debug_check_is_edge(int e) { /// Implementation of DGraph that has no dimensionality, ie no data /// stored for vertieces besides indices. /// - public class DGraphN : DGraph + [Serializable] public class DGraphN : DGraph { public int AppendVertex() { diff --git a/curve/DGraph2.cs b/curve/DGraph2.cs index a3c501ed..4ce7ada8 100644 --- a/curve/DGraph2.cs +++ b/curve/DGraph2.cs @@ -12,7 +12,7 @@ namespace g3 /// Each vertex can be connected to an arbitrary number of edges. /// Each vertex can have a 3-float color, and edge edge can have an integer GroupID /// - public class DGraph2 : DGraph + [Serializable] public class DGraph2 : DGraph { public static readonly Vector2d InvalidVertex = new Vector2d(Double.MaxValue, 0); diff --git a/curve/DGraph2Resampler.cs b/curve/DGraph2Resampler.cs index e3f8d769..3278ffb0 100644 --- a/curve/DGraph2Resampler.cs +++ b/curve/DGraph2Resampler.cs @@ -8,7 +8,7 @@ namespace g3 /// /// "Remesher" for DGraph2 /// - public class DGraph2Resampler + [Serializable] public class DGraph2Resampler { public DGraph2 Graph; diff --git a/curve/DGraph2Util.cs b/curve/DGraph2Util.cs index 0bb8512d..d1b2f600 100644 --- a/curve/DGraph2Util.cs +++ b/curve/DGraph2Util.cs @@ -14,7 +14,7 @@ public static class DGraph2Util { - public class Curves + [Serializable] public class Curves { public List Loops; public List Paths; diff --git a/curve/DGraph3.cs b/curve/DGraph3.cs index b0b255aa..033eda2f 100644 --- a/curve/DGraph3.cs +++ b/curve/DGraph3.cs @@ -12,7 +12,7 @@ namespace g3 /// Each vertex can be connected to an arbitrary number of edges. /// Each vertex can have a 3-float color, and edge edge can have an integer GroupID /// - public class DGraph3 : DGraph + [Serializable] public class DGraph3 : DGraph { public static readonly Vector3d InvalidVertex = new Vector3d(Double.MaxValue, 0, 0); diff --git a/curve/DGraph3Util.cs b/curve/DGraph3Util.cs index 1bf54209..5b81f860 100644 --- a/curve/DGraph3Util.cs +++ b/curve/DGraph3Util.cs @@ -12,7 +12,7 @@ namespace g3 /// public static class DGraph3Util { - public struct Curves + [Serializable] public struct Curves { public List Loops; public List Paths; diff --git a/curve/Ellipse2.cs b/curve/Ellipse2.cs index 8a4457a2..36fd8287 100644 --- a/curve/Ellipse2.cs +++ b/curve/Ellipse2.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 Ellipse2 - public class Ellipse2d : IParametricCurve2d + [Serializable] public class Ellipse2d : IParametricCurve2d { // An ellipse has center K, axis directions U[0] and U[1] (both // unit-length vectors), and extents e[0] and e[1] (both positive diff --git a/curve/EllipseArc2.cs b/curve/EllipseArc2.cs index 07c491e0..9958dcac 100644 --- a/curve/EllipseArc2.cs +++ b/curve/EllipseArc2.cs @@ -22,7 +22,7 @@ namespace g3 { // on two concentric circles w/ radii of major/minor axes. Possibly that is what // the formula in SampleT is doing? // - public class EllipseArc2d : IParametricCurve2d + [Serializable] public class EllipseArc2d : IParametricCurve2d { public Vector2d Center; public Vector2d Axis0, Axis1; diff --git a/curve/GeneralPolygon2d.cs b/curve/GeneralPolygon2d.cs index cc15dffa..78d68a21 100644 --- a/curve/GeneralPolygon2d.cs +++ b/curve/GeneralPolygon2d.cs @@ -4,7 +4,7 @@ namespace g3 { - public class GeneralPolygon2d : IDuplicatable + [Serializable] public class GeneralPolygon2d : IDuplicatable { Polygon2d outer; bool bOuterIsCW; diff --git a/curve/Hexagon2.cs b/curve/Hexagon2.cs index cd51073a..03bf39ea 100644 --- a/curve/Hexagon2.cs +++ b/curve/Hexagon2.cs @@ -2,7 +2,7 @@ namespace g3 { - public class Hexagon2d + [Serializable] public class Hexagon2d { public enum TopModes { diff --git a/curve/LaplacianCurveDeformer.cs b/curve/LaplacianCurveDeformer.cs index 4debee3c..437ee409 100644 --- a/curve/LaplacianCurveDeformer.cs +++ b/curve/LaplacianCurveDeformer.cs @@ -12,7 +12,7 @@ namespace g3 /// Currently only supports uniform weights (in Initialize) /// /// - public class LaplacianCurveDeformer + [Serializable] public class LaplacianCurveDeformer { public DCurve3 Curve; @@ -35,7 +35,7 @@ public class LaplacianCurveDeformer double[] MLx, MLy, MLz; // constraints - public struct SoftConstraintV + [Serializable] public struct SoftConstraintV { public Vector3d Position; public double Weight; diff --git a/curve/NURBSCurve2.cs b/curve/NURBSCurve2.cs index 472f3503..a0097554 100644 --- a/curve/NURBSCurve2.cs +++ b/curve/NURBSCurve2.cs @@ -6,7 +6,7 @@ namespace g3 { // ported from WildMagic5 NURBSCurve2 - public class NURBSCurve2 : BaseCurve2, IParametricCurve2d + [Serializable] public class NURBSCurve2 : BaseCurve2, IParametricCurve2d { // Construction and destruction. Internal copies of the // input arrays are made, so to dynamically change control points, @@ -253,7 +253,7 @@ public override Vector2d GetThirdDerivative(double t) // derivatives. It will stop at the highest derivative you request. // More efficient than calling single-value functions above, which // would repeat lots of calculations - public struct CurveDerivatives + [Serializable] public struct CurveDerivatives { public Vector2d p, d1, d2, d3; public bool bPosition, bDer1, bDer2, bDer3; diff --git a/curve/ParametricCurveSequence2.cs b/curve/ParametricCurveSequence2.cs index 44325842..30348946 100644 --- a/curve/ParametricCurveSequence2.cs +++ b/curve/ParametricCurveSequence2.cs @@ -4,7 +4,7 @@ namespace g3 { - public class ParametricCurveSequence2 : IParametricCurve2d, IMultiCurve2d + [Serializable] public class ParametricCurveSequence2 : IParametricCurve2d, IMultiCurve2d { List curves; diff --git a/curve/PlanarComplex.cs b/curve/PlanarComplex.cs index 0583458c..cd22cdb9 100644 --- a/curve/PlanarComplex.cs +++ b/curve/PlanarComplex.cs @@ -5,13 +5,13 @@ namespace g3 { - public struct ComplexSegment2d + [Serializable] public struct ComplexSegment2d { public Segment2d seg; public bool isClosed; public PlanarComplex.Element element; } - public struct ComplexEndpoint2d + [Serializable] public struct ComplexEndpoint2d { public Vector2d v; public bool isStart; @@ -19,7 +19,7 @@ public struct ComplexEndpoint2d } - public class PlanarComplex + [Serializable] public class PlanarComplex { // these determine pointwise sampling rates public double DistanceAccuracy = 0.1; @@ -57,7 +57,7 @@ protected void copy_to(Element new_element) public abstract Element Clone(); } - public class SmoothCurveElement : Element + [Serializable] public class SmoothCurveElement : Element { public PolyLine2d polyLine; @@ -76,7 +76,7 @@ public override Element Clone() { } } - public class SmoothLoopElement : Element + [Serializable] public class SmoothLoopElement : Element { public Polygon2d polygon; @@ -411,13 +411,13 @@ void append(SmoothCurveElement cTo, SmoothCurveElement cAppend) { - public class GeneralSolid + [Serializable] public class GeneralSolid { public Element Outer; public List Holes = new List(); } - public class SolidRegionInfo + [Serializable] public class SolidRegionInfo { public List Polygons; public List Solids; @@ -459,7 +459,7 @@ public double HolesArea { - public struct FindSolidsOptions + [Serializable] public struct FindSolidsOptions { public double SimplifyDeviationTolerance; public bool WantCurveSolids; @@ -761,7 +761,7 @@ public SolidRegionInfo FindSolidRegions(FindSolidsOptions options) - public class ClosedLoopsInfo + [Serializable] public class ClosedLoopsInfo { public List Polygons; public List Loops; @@ -820,7 +820,7 @@ public ClosedLoopsInfo FindClosedLoops(double fSimplifyDeviationTol = 0.1) - public class OpenCurvesInfo + [Serializable] public class OpenCurvesInfo { public List Polylines; public List Curves; diff --git a/curve/PlanarSolid2d.cs b/curve/PlanarSolid2d.cs index 5997f740..1c0dcf16 100644 --- a/curve/PlanarSolid2d.cs +++ b/curve/PlanarSolid2d.cs @@ -11,7 +11,7 @@ namespace g3 // // So, it is strongly recommended that this be constructed alongside a GeneralPolygon2d, // which can be used for checking everything. - public class PlanarSolid2d + [Serializable] public class PlanarSolid2d { IParametricCurve2d outer; //bool bOuterIsCW; diff --git a/curve/PolyLine2d.cs b/curve/PolyLine2d.cs index 213ff496..5e44d6ce 100644 --- a/curve/PolyLine2d.cs +++ b/curve/PolyLine2d.cs @@ -6,7 +6,7 @@ namespace g3 { - public class PolyLine2d : IEnumerable + [Serializable] public class PolyLine2d : IEnumerable { protected List vertices; public int Timestamp; @@ -384,7 +384,7 @@ static public PolyLine2d MakeBoxSpiral(Vector2d center, double len, double spaci /// /// Wrapper for a PolyLine2d that provides minimal IParametricCurve2D interface /// - public class PolyLine2DCurve : IParametricCurve2d + [Serializable] public class PolyLine2DCurve : IParametricCurve2d { public PolyLine2d Polyline; diff --git a/curve/PolyLine2f.cs b/curve/PolyLine2f.cs index 26871f69..86b954dc 100644 --- a/curve/PolyLine2f.cs +++ b/curve/PolyLine2f.cs @@ -7,16 +7,16 @@ namespace g3 /// /// Summary description for PolyLine. /// - public class DPolyLine2f + [Serializable] public class DPolyLine2f { - public struct Edge { + [Serializable] public struct Edge { public int v1; public int v2; public Edge( int vertex1, int vertex2 ) {v1 = vertex1; v2 = vertex2;} } - public struct Vertex { + [Serializable] public struct Vertex { public int index; public float x; public float y; diff --git a/curve/PolyLine3d.cs b/curve/PolyLine3d.cs index 8e07cf78..4931131b 100644 --- a/curve/PolyLine3d.cs +++ b/curve/PolyLine3d.cs @@ -5,7 +5,7 @@ namespace g3 { - public class PolyLine3d : IEnumerable + [Serializable] public class PolyLine3d : IEnumerable { protected List vertices; public int Timestamp; diff --git a/curve/PolySimplification2.cs b/curve/PolySimplification2.cs index acce4bdb..e564f3e4 100644 --- a/curve/PolySimplification2.cs +++ b/curve/PolySimplification2.cs @@ -25,7 +25,7 @@ namespace g3 /// [TODO] 2d variant of variational shape segmentation? /// /// - public class PolySimplification2 + [Serializable] public class PolySimplification2 { List Vertices; bool IsLoop; diff --git a/curve/Polygon2d.cs b/curve/Polygon2d.cs index b74287ca..a1f0d2b1 100644 --- a/curve/Polygon2d.cs +++ b/curve/Polygon2d.cs @@ -7,7 +7,7 @@ namespace g3 { - public class Polygon2d : IDuplicatable + [Serializable] public class Polygon2d : IDuplicatable { protected List vertices; public int Timestamp; @@ -793,7 +793,7 @@ static public Polygon2d MakeCircle(double fRadius, int nSteps, double angleShift /// /// Wrapper for a Polygon2d that provides minimal IParametricCurve2D interface /// - public class Polygon2DCurve : IParametricCurve2d + [Serializable] public class Polygon2DCurve : IParametricCurve2d { public Polygon2d Polygon; diff --git a/curve/PolygonFont2d.cs b/curve/PolygonFont2d.cs index 47e577b4..a0d263b1 100644 --- a/curve/PolygonFont2d.cs +++ b/curve/PolygonFont2d.cs @@ -11,9 +11,9 @@ namespace g3 /// Each font is a list of GeneralPolygon2D objects, so each outline may have 1 or more holes. /// (In fact, the mapping is [string,list_of_gpolygons], so you can actually keep entire strings together if desired) /// - public class PolygonFont2d + [Serializable] public class PolygonFont2d { - public class CharacterInfo + [Serializable] public class CharacterInfo { public GeneralPolygon2d[] Polygons; public AxisAlignedBox2d Bounds; diff --git a/curve/SculptCurveDeformers.cs b/curve/SculptCurveDeformers.cs index ebcadf09..a640a802 100644 --- a/curve/SculptCurveDeformers.cs +++ b/curve/SculptCurveDeformers.cs @@ -52,7 +52,7 @@ public virtual void BeginDeformation(Frame3f vStartPos) } - public struct DeformInfo + [Serializable] public struct DeformInfo { public bool bNoChange; public double maxEdgeLenSqr; @@ -74,7 +74,7 @@ public virtual DeformInfo UpdateDeformation(Frame3f vNextPos) - public class StandardSculptCurveDeformation : SculptCurveDeformation + [Serializable] public class StandardSculptCurveDeformation : SculptCurveDeformation { // Deformation function. // Arguments are curve index and weight "t" value in range [0,1] @@ -186,7 +186,7 @@ public override DeformInfo Apply(Frame3f vNextPos) // just apply smoothing pass from standard op - public class SculptCurveSmooth : StandardSculptCurveDeformation + [Serializable] public class SculptCurveSmooth : StandardSculptCurveDeformation { public SculptCurveSmooth() { @@ -199,7 +199,7 @@ public SculptCurveSmooth() - public class SculptCurveMove : StandardSculptCurveDeformation + [Serializable] public class SculptCurveMove : StandardSculptCurveDeformation { public SculptCurveMove() diff --git a/curve/SimpleCurveDeformers.cs b/curve/SimpleCurveDeformers.cs index 44f4ee56..3cf70c65 100644 --- a/curve/SimpleCurveDeformers.cs +++ b/curve/SimpleCurveDeformers.cs @@ -6,7 +6,7 @@ namespace g3 { - public class InPlaceIterativeCurveSmooth + [Serializable] public class InPlaceIterativeCurveSmooth { DCurve3 _curve; public DCurve3 Curve { @@ -101,7 +101,7 @@ public void UpdateDeformation_Open(int nIterations = 1) - public class ArcLengthSoftTranslation + [Serializable] public class ArcLengthSoftTranslation { DCurve3 _curve; public DCurve3 Curve { diff --git a/distance/DistLine2Line2.cs b/distance/DistLine2Line2.cs index 565e1194..7739a803 100644 --- a/distance/DistLine2Line2.cs +++ b/distance/DistLine2Line2.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistLine2Line2 + [Serializable] public class DistLine2Line2 { Line2d line1; public Line2d Line diff --git a/distance/DistLine2Segment2.cs b/distance/DistLine2Segment2.cs index b7e4f2d5..39713ff8 100644 --- a/distance/DistLine2Segment2.cs +++ b/distance/DistLine2Segment2.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistLine2Segment2 + [Serializable] public class DistLine2Segment2 { Line2d line; public Line2d Line diff --git a/distance/DistLine3Ray3.cs b/distance/DistLine3Ray3.cs index 01cab404..7c94909c 100644 --- a/distance/DistLine3Ray3.cs +++ b/distance/DistLine3Ray3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistLine3Ray3 + [Serializable] public class DistLine3Ray3 { Line3d line; public Line3d Line diff --git a/distance/DistLine3Segment3.cs b/distance/DistLine3Segment3.cs index 39e21200..79d5dc4c 100644 --- a/distance/DistLine3Segment3.cs +++ b/distance/DistLine3Segment3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistLine3Segment3 + [Serializable] public class DistLine3Segment3 { Line3d line; public Line3d Line diff --git a/distance/DistLine3Triangle3.cs b/distance/DistLine3Triangle3.cs index 6d22a7e0..c2528065 100644 --- a/distance/DistLine3Triangle3.cs +++ b/distance/DistLine3Triangle3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistLine3Triangle3 + [Serializable] public class DistLine3Triangle3 { Line3d line; public Line3d Line diff --git a/distance/DistPoint2Box2.cs b/distance/DistPoint2Box2.cs index 60d311ac..ca8009d3 100644 --- a/distance/DistPoint2Box2.cs +++ b/distance/DistPoint2Box2.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5's DistPoint2Box2 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistPoint2Box2 + [Serializable] public class DistPoint2Box2 { Vector2d point; public Vector2d Point diff --git a/distance/DistPoint2Circle2.cs b/distance/DistPoint2Circle2.cs index d216baca..88b0d688 100644 --- a/distance/DistPoint2Circle2.cs +++ b/distance/DistPoint2Circle2.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5's DistPoint3Circle3 (didn't have point2circle2) // https://www.geometrictools.com/Downloads/Downloads.html - public class DistPoint2Circle2 + [Serializable] public class DistPoint2Circle2 { Vector2d point; public Vector2d Point diff --git a/distance/DistPoint3Circle3.cs b/distance/DistPoint3Circle3.cs index 749f4e9c..617816e9 100644 --- a/distance/DistPoint3Circle3.cs +++ b/distance/DistPoint3Circle3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistPoint3Circle3 + [Serializable] public class DistPoint3Circle3 { Vector3d point; public Vector3d Point diff --git a/distance/DistPoint3Cylinder3.cs b/distance/DistPoint3Cylinder3.cs index d63618c3..dad8a45e 100644 --- a/distance/DistPoint3Cylinder3.cs +++ b/distance/DistPoint3Cylinder3.cs @@ -15,7 +15,7 @@ namespace g3 // // DistanceSquared is always positive!! // - public class DistPoint3Cylinder3 + [Serializable] public class DistPoint3Cylinder3 { Vector3d point; public Vector3d Point diff --git a/distance/DistPoint3Triangle3.cs b/distance/DistPoint3Triangle3.cs index 3ba058a7..410472eb 100644 --- a/distance/DistPoint3Triangle3.cs +++ b/distance/DistPoint3Triangle3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistPoint3Triangle3 + [Serializable] public class DistPoint3Triangle3 { Vector3d point; public Vector3d Point diff --git a/distance/DistRay3Ray3.cs b/distance/DistRay3Ray3.cs index 0adf4866..94d2614b 100644 --- a/distance/DistRay3Ray3.cs +++ b/distance/DistRay3Ray3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistRay3Ray3 + [Serializable] public class DistRay3Ray3 { Ray3d ray1; public Ray3d Ray1 diff --git a/distance/DistRay3Segment3.cs b/distance/DistRay3Segment3.cs index a6dc4b6a..d08b22db 100644 --- a/distance/DistRay3Segment3.cs +++ b/distance/DistRay3Segment3.cs @@ -9,7 +9,7 @@ namespace g3 /// Distance between ray and segment /// ported from WildMagic5 /// - public class DistRay3Segment3 + [Serializable] public class DistRay3Segment3 { Ray3d ray; public Ray3d Ray diff --git a/distance/DistSegment2Segment2.cs b/distance/DistSegment2Segment2.cs index 3b02bd98..c5b3fbb7 100644 --- a/distance/DistSegment2Segment2.cs +++ b/distance/DistSegment2Segment2.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistSegment2Segment2 + [Serializable] public class DistSegment2Segment2 { Segment2d segment0; public Segment2d Segment1 diff --git a/distance/DistSegment3Triangle3.cs b/distance/DistSegment3Triangle3.cs index 120866a7..2fb5e4b6 100644 --- a/distance/DistSegment3Triangle3.cs +++ b/distance/DistSegment3Triangle3.cs @@ -8,7 +8,7 @@ namespace g3 // ported from WildMagic 5 // https://www.geometrictools.com/Downloads/Downloads.html - public class DistSegment3Triangle3 + [Serializable] public class DistSegment3Triangle3 { Segment3d segment; public Segment3d Segment diff --git a/distance/DistTriangle3Triangle3.cs b/distance/DistTriangle3Triangle3.cs index cea54ac1..0bbe43f6 100644 --- a/distance/DistTriangle3Triangle3.cs +++ b/distance/DistTriangle3Triangle3.cs @@ -5,7 +5,7 @@ namespace g3 { - public class DistTriangle3Triangle3 + [Serializable] public class DistTriangle3Triangle3 { Triangle3d triangle0; public Triangle3d Triangle0 diff --git a/implicit/CachingGridImplicit3d.cs b/implicit/CachingGridImplicit3d.cs index e04ffdb5..5db38dd6 100644 --- a/implicit/CachingGridImplicit3d.cs +++ b/implicit/CachingGridImplicit3d.cs @@ -15,7 +15,7 @@ namespace g3 /// via GridOrigin, but does not support scaling or rotation. If you need those, /// you can wrap this in something that does the xform. /// - public class CachingDenseGridTrilinearImplicit : BoundedImplicitFunction3d + [Serializable] public class CachingDenseGridTrilinearImplicit : BoundedImplicitFunction3d { public DenseGrid3f Grid; public double CellSize; diff --git a/implicit/CachingMeshSDF.cs b/implicit/CachingMeshSDF.cs index e2931bb9..5d4700da 100644 --- a/implicit/CachingMeshSDF.cs +++ b/implicit/CachingMeshSDF.cs @@ -45,7 +45,7 @@ namespace g3 /// Original license was public domain. /// Permission granted by Christopher Batty to include C# port under Boost license. /// - public class CachingMeshSDF + [Serializable] public class CachingMeshSDF { public DMesh3 Mesh; public DMeshAABBTree3 Spatial; @@ -70,7 +70,7 @@ public class CachingMeshSDF // Parity count is basically mesh winding number, handles overlap shells and // self-intersections, but inverted shells are 'subtracted', and inverted faces are a disaster. // Both modes handle internal cavities, neither handles open sheets. - public enum InsideModes + [Serializable] public enum InsideModes { CrossingCount = 0, ParityCount = 1 @@ -414,7 +414,7 @@ static public bool point_in_triangle_2d(double x0, double y0, /// via GridOrigin, but does not support scaling or rotation. If you need those, /// you can wrap this in something that does the xform. /// - public class CachingMeshSDFImplicit : BoundedImplicitFunction3d + [Serializable] public class CachingMeshSDFImplicit : BoundedImplicitFunction3d { public CachingMeshSDF SDF; public double CellSize; diff --git a/implicit/FalloffFunctions.cs b/implicit/FalloffFunctions.cs index 27b7e0ac..9fcb18e7 100644 --- a/implicit/FalloffFunctions.cs +++ b/implicit/FalloffFunctions.cs @@ -26,7 +26,7 @@ public interface IFalloffFunction /// /// returns 1 in range [0,ConstantRange], and then falls off to 0 in range [ConstantRange,1] /// - public class LinearFalloff : IFalloffFunction + [Serializable] public class LinearFalloff : IFalloffFunction { public double ConstantRange = 0; @@ -53,7 +53,7 @@ public IFalloffFunction Duplicate() /// /// returns 1 in range [0,ConstantRange], and then falls off to 0 in range [ConstantRange,1] /// - public class WyvillFalloff : IFalloffFunction + [Serializable] public class WyvillFalloff : IFalloffFunction { public double ConstantRange = 0; diff --git a/implicit/GridImplicits3d.cs b/implicit/GridImplicits3d.cs index 6e2d1fe8..ff98cbe5 100644 --- a/implicit/GridImplicits3d.cs +++ b/implicit/GridImplicits3d.cs @@ -10,7 +10,7 @@ namespace g3 /// via GridOrigin, but does not support scaling or rotation. If you need those, /// you can wrap this in something that does the xform. /// - public class DenseGridTrilinearImplicit : BoundedImplicitFunction3d + [Serializable] public class DenseGridTrilinearImplicit : BoundedImplicitFunction3d { public DenseGrid3f Grid; public double CellSize; diff --git a/implicit/Implicit2d.cs b/implicit/Implicit2d.cs index f46158f0..12ea831a 100644 --- a/implicit/Implicit2d.cs +++ b/implicit/Implicit2d.cs @@ -23,7 +23,7 @@ public interface ImplicitOperator2d : ImplicitField2d - public class ImplicitPoint2d : ImplicitField2d + [Serializable] public class ImplicitPoint2d : ImplicitField2d { Vector2f m_vCenter; private float m_radius; diff --git a/implicit/Implicit3d.cs b/implicit/Implicit3d.cs index ea6d70cc..e7579bf8 100644 --- a/implicit/Implicit3d.cs +++ b/implicit/Implicit3d.cs @@ -26,7 +26,7 @@ public interface BoundedImplicitFunction3d : ImplicitFunction3d /// /// Implicit sphere, where zero isocontour is at Radius /// - public class ImplicitSphere3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitSphere3d : BoundedImplicitFunction3d { public Vector3d Origin; public double Radius; @@ -46,7 +46,7 @@ public AxisAlignedBox3d Bounds() /// /// Implicit half-space. "Inside" is opposite of Normal direction. /// - public class ImplicitHalfSpace3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitHalfSpace3d : BoundedImplicitFunction3d { public Vector3d Origin; public Vector3d Normal; @@ -67,7 +67,7 @@ public AxisAlignedBox3d Bounds() /// /// Implicit axis-aligned box /// - public class ImplicitAxisAlignedBox3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitAxisAlignedBox3d : BoundedImplicitFunction3d { public AxisAlignedBox3d AABox; @@ -87,7 +87,7 @@ public AxisAlignedBox3d Bounds() /// /// Implicit oriented box /// - public class ImplicitBox3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitBox3d : BoundedImplicitFunction3d { Box3d box; AxisAlignedBox3d local_aabb; @@ -123,7 +123,7 @@ public AxisAlignedBox3d Bounds() /// /// Implicit tube around line segment /// - public class ImplicitLine3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitLine3d : BoundedImplicitFunction3d { public Segment3d Segment; public double Radius; @@ -151,7 +151,7 @@ public AxisAlignedBox3d Bounds() /// Offset the zero-isocontour of an implicit function. /// Assumes that negative is inside, if not, reverse offset. /// - public class ImplicitOffset3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitOffset3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public double Offset; @@ -177,7 +177,7 @@ public AxisAlignedBox3d Bounds() /// field, this converts single isocontour into two nested isocontours /// with zeros at interval a and b, with 'inside' in interval /// - public class ImplicitShell3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitShell3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public Interval1d Inside; @@ -209,7 +209,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitUnion3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitUnion3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -234,7 +234,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitIntersection3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitIntersection3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -260,7 +260,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitDifference3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitDifference3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -285,7 +285,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitNaryUnion3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitNaryUnion3d : BoundedImplicitFunction3d { public List Children; @@ -316,7 +316,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitNaryIntersection3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitNaryIntersection3d : BoundedImplicitFunction3d { public List Children; @@ -349,7 +349,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitNaryDifference3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitNaryDifference3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public List BSet; @@ -381,7 +381,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitSmoothUnion3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitSmoothUnion3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -408,7 +408,7 @@ public AxisAlignedBox3d Bounds() { /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitSmoothIntersection3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitSmoothIntersection3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -436,7 +436,7 @@ public AxisAlignedBox3d Bounds() { /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class ImplicitSmoothDifference3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitSmoothDifference3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -463,7 +463,7 @@ public AxisAlignedBox3d Bounds() { /// Blend of two implicit surfaces. Assumes surface is at zero iscontour. /// Uses Pasko blend from http://www.hyperfun.org/F-rep.pdf /// - public class ImplicitBlend3d : BoundedImplicitFunction3d + [Serializable] public class ImplicitBlend3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -537,7 +537,7 @@ public AxisAlignedBox3d Bounds() /// the distance=0 isocontour lying just before midway in /// the range (at the .ZeroIsocontour constant) /// - public class DistanceFieldToSkeletalField : BoundedImplicitFunction3d + [Serializable] public class DistanceFieldToSkeletalField : BoundedImplicitFunction3d { public BoundedImplicitFunction3d DistanceField; public double FalloffDistance; @@ -572,7 +572,7 @@ public double Value(ref Vector3d pt) /// /// sum-blend /// - public class SkeletalBlend3d : BoundedImplicitFunction3d + [Serializable] public class SkeletalBlend3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -596,7 +596,7 @@ public AxisAlignedBox3d Bounds() /// /// Ricci blend /// - public class SkeletalRicciBlend3d : BoundedImplicitFunction3d + [Serializable] public class SkeletalRicciBlend3d : BoundedImplicitFunction3d { public BoundedImplicitFunction3d A; public BoundedImplicitFunction3d B; @@ -632,7 +632,7 @@ public AxisAlignedBox3d Bounds() /// Assumption is that both have surface at zero isocontour and /// negative is inside. /// - public class SkeletalRicciNaryBlend3d : BoundedImplicitFunction3d + [Serializable] public class SkeletalRicciNaryBlend3d : BoundedImplicitFunction3d { public List Children; public double BlendPower = 2.0; diff --git a/implicit/ImplicitFieldSampler3d.cs b/implicit/ImplicitFieldSampler3d.cs index 8f01b3fa..a825205a 100644 --- a/implicit/ImplicitFieldSampler3d.cs +++ b/implicit/ImplicitFieldSampler3d.cs @@ -8,7 +8,7 @@ namespace g3 /// /// Sample implicit fields into a dense grid /// - public class ImplicitFieldSampler3d + [Serializable] public class ImplicitFieldSampler3d { public DenseGrid3f Grid; public double CellSize; @@ -19,7 +19,7 @@ public class ImplicitFieldSampler3d public float BackgroundValue; - public enum CombineModes + [Serializable] public enum CombineModes { DistanceMinUnion = 0 } diff --git a/implicit/MarchingQuads.cs b/implicit/MarchingQuads.cs index 03a324ba..68889e80 100644 --- a/implicit/MarchingQuads.cs +++ b/implicit/MarchingQuads.cs @@ -9,7 +9,7 @@ namespace g3 /// [TODO] this is very, very old code. Should at minimum rewrite using current /// vector classes/etc. /// - public class MarchingQuads + [Serializable] public class MarchingQuads { DPolyLine2f m_stroke; diff --git a/intersection/Intersector1.cs b/intersection/Intersector1.cs index 073108c6..b6b7183d 100644 --- a/intersection/Intersector1.cs +++ b/intersection/Intersector1.cs @@ -11,7 +11,7 @@ namespace g3 // // [TODO] could this be struct? is not used in contexts where we necessarily need a new object... // - public class Intersector1 + [Serializable] public class Intersector1 { // intervals to intersect public Interval1d U; diff --git a/intersection/IntrLine2Line2.cs b/intersection/IntrLine2Line2.cs index 45b9625b..4890fd04 100644 --- a/intersection/IntrLine2Line2.cs +++ b/intersection/IntrLine2Line2.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrLine2Line2 + [Serializable] public class IntrLine2Line2 { Line2d line1; public Line2d Line1 diff --git a/intersection/IntrLine2Segment2.cs b/intersection/IntrLine2Segment2.cs index ba70f758..e89cfbdf 100644 --- a/intersection/IntrLine2Segment2.cs +++ b/intersection/IntrLine2Segment2.cs @@ -33,7 +33,7 @@ namespace g3 // q = int.MaxValue: The line/segment are collinear. Type is Segment. - public class IntrLine2Segment2 + [Serializable] public class IntrLine2Segment2 { Line2d line; public Line2d Line { diff --git a/intersection/IntrLine2Triangle2.cs b/intersection/IntrLine2Triangle2.cs index b1ad8f45..87f416bc 100644 --- a/intersection/IntrLine2Triangle2.cs +++ b/intersection/IntrLine2Triangle2.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrLine2Triangle2 + [Serializable] public class IntrLine2Triangle2 { Line2d line; public Line2d Line diff --git a/intersection/IntrLine3AxisAlignedBox3.cs b/intersection/IntrLine3AxisAlignedBox3.cs index 16c71bf0..dc8161b3 100644 --- a/intersection/IntrLine3AxisAlignedBox3.cs +++ b/intersection/IntrLine3AxisAlignedBox3.cs @@ -6,7 +6,7 @@ namespace g3 { // adapted from IntrLine3Box3 - public class IntrLine3AxisAlignedBox3 + [Serializable] public class IntrLine3AxisAlignedBox3 { Line3d line; public Line3d Line diff --git a/intersection/IntrLine3Box3.cs b/intersection/IntrLine3Box3.cs index 28a68848..38f03ac8 100644 --- a/intersection/IntrLine3Box3.cs +++ b/intersection/IntrLine3Box3.cs @@ -6,7 +6,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrLine3Box3 + [Serializable] public class IntrLine3Box3 { Line3d line; public Line3d Line diff --git a/intersection/IntrRay3AxisAlignedBox3.cs b/intersection/IntrRay3AxisAlignedBox3.cs index 1c2ddb5d..62ee7bce 100644 --- a/intersection/IntrRay3AxisAlignedBox3.cs +++ b/intersection/IntrRay3AxisAlignedBox3.cs @@ -6,7 +6,7 @@ namespace g3 { // adapted from IntrRay3Box3 - public class IntrRay3AxisAlignedBox3 + [Serializable] public class IntrRay3AxisAlignedBox3 { Ray3d ray; public Ray3d Ray diff --git a/intersection/IntrRay3Box3.cs b/intersection/IntrRay3Box3.cs index 278a7f5f..b1d2d589 100644 --- a/intersection/IntrRay3Box3.cs +++ b/intersection/IntrRay3Box3.cs @@ -6,7 +6,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrRay3Box3 + [Serializable] public class IntrRay3Box3 { Ray3d ray; public Ray3d Ray diff --git a/intersection/IntrRay3Triangle3.cs b/intersection/IntrRay3Triangle3.cs index 611c907f..ec9f6f73 100644 --- a/intersection/IntrRay3Triangle3.cs +++ b/intersection/IntrRay3Triangle3.cs @@ -5,7 +5,7 @@ namespace g3 { - public class IntrRay3Triangle3 + [Serializable] public class IntrRay3Triangle3 { Ray3d ray; public Ray3d Ray diff --git a/intersection/IntrSegment2Segment2.cs b/intersection/IntrSegment2Segment2.cs index e3009717..3e5f6190 100644 --- a/intersection/IntrSegment2Segment2.cs +++ b/intersection/IntrSegment2Segment2.cs @@ -34,7 +34,7 @@ namespace g3 // Type is Segment. Points are Point0 and Point1 - public class IntrSegment2Segment2 + [Serializable] public class IntrSegment2Segment2 { Segment2d segment1; public Segment2d Segment1 diff --git a/intersection/IntrSegment2Triangle2.cs b/intersection/IntrSegment2Triangle2.cs index 468685ed..20900b86 100644 --- a/intersection/IntrSegment2Triangle2.cs +++ b/intersection/IntrSegment2Triangle2.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrSegment2Triangle2 + [Serializable] public class IntrSegment2Triangle2 { Segment2d segment; public Segment2d Segment diff --git a/intersection/IntrSegment3Box3.cs b/intersection/IntrSegment3Box3.cs index cef6645f..001a07be 100644 --- a/intersection/IntrSegment3Box3.cs +++ b/intersection/IntrSegment3Box3.cs @@ -6,7 +6,7 @@ namespace g3 { // ported from WildMagic5 - public class IntrSegment3Box3 + [Serializable] public class IntrSegment3Box3 { Segment3d segment; public Segment3d Segment diff --git a/intersection/IntrTriangle2Triangle2.cs b/intersection/IntrTriangle2Triangle2.cs index 9284533e..e351ab3a 100644 --- a/intersection/IntrTriangle2Triangle2.cs +++ b/intersection/IntrTriangle2Triangle2.cs @@ -4,7 +4,7 @@ namespace g3 { // ported from WildMagic5 // [TODO] Vector2d 6-tuple, to avoid internal arrays - public class IntrTriangle2Triangle2 + [Serializable] public class IntrTriangle2Triangle2 { Triangle2d triangle0; public Triangle2d Triangle0 diff --git a/intersection/IntrTriangle3Triangle3.cs b/intersection/IntrTriangle3Triangle3.cs index 1fda8145..9a82ed8c 100644 --- a/intersection/IntrTriangle3Triangle3.cs +++ b/intersection/IntrTriangle3Triangle3.cs @@ -8,7 +8,7 @@ namespace g3 // use Find() to compute full information // By default fully-contained co-planar triangles are not reported as intersecting. // set ReportCoplanarIntersection=true to handle this case (more expensive) - public class IntrTriangle3Triangle3 + [Serializable] public class IntrTriangle3Triangle3 { Triangle3d triangle0; public Triangle3d Triangle0 diff --git a/io/BinaryG3ReaderWriter.cs b/io/BinaryG3ReaderWriter.cs index 650fc872..c223470f 100644 --- a/io/BinaryG3ReaderWriter.cs +++ b/io/BinaryG3ReaderWriter.cs @@ -9,7 +9,7 @@ namespace g3 { - public class BinaryG3Writer : IMeshWriter + [Serializable] public class BinaryG3Writer : IMeshWriter { public IOWriteResult Write(BinaryWriter writer, List vMeshes, WriteOptions options) { @@ -34,7 +34,7 @@ public IOWriteResult Write(TextWriter writer, List vMeshes, WriteOpti - public class BinaryG3Reader : IMeshReader + [Serializable] public class BinaryG3Reader : IMeshReader { public IOReadResult Read(BinaryReader reader, ReadOptions options, IMeshBuilder builder) { diff --git a/io/MaterialTypes.cs b/io/MaterialTypes.cs index af465c74..42281b0f 100644 --- a/io/MaterialTypes.cs +++ b/io/MaterialTypes.cs @@ -19,7 +19,7 @@ public abstract class GenericMaterial abstract public float Alpha { get; set; } - public enum KnownMaterialTypes + [Serializable] public enum KnownMaterialTypes { OBJ_MTL_Format } @@ -30,7 +30,7 @@ public enum KnownMaterialTypes // details: http://www.fileformat.info/format/material/ // Note: if value is initialized to Invalid vector, -1, or NaN, it was not defined in material file - public class OBJMaterial : GenericMaterial + [Serializable] public class OBJMaterial : GenericMaterial { public Vector3f Ka; // rgb ambient reflectivity public Vector3f Kd; // rgb diffuse reflectivity diff --git a/io/MeshIO.cs b/io/MeshIO.cs index 75711002..74e5e5f7 100644 --- a/io/MeshIO.cs +++ b/io/MeshIO.cs @@ -7,7 +7,7 @@ namespace g3 { - public enum IOCode + [Serializable] public enum IOCode { Ok = 0, @@ -32,7 +32,7 @@ public enum IOCode - public class ReadOptions + [Serializable] public class ReadOptions { public bool ReadMaterials; @@ -50,7 +50,7 @@ public ReadOptions() }; } - public struct IOReadResult + [Serializable] public struct IOReadResult { public IOCode code { get; set; } public string message { get; set; } @@ -75,7 +75,7 @@ public interface IMeshReader - public struct IOWriteResult + [Serializable] public struct IOWriteResult { public IOCode code { get; set; } public string message { get; set; } @@ -90,7 +90,7 @@ public IOWriteResult( IOCode r, string s ) : this() public static readonly IOWriteResult Ok = new IOWriteResult(IOCode.Ok, ""); } - public struct WriteOptions + [Serializable] public struct WriteOptions { public bool bWriteBinary; // write binary format if supported (STL) @@ -132,7 +132,7 @@ public struct WriteOptions } - public struct WriteMesh + [Serializable] public struct WriteMesh { public IMesh Mesh; public string Name; // supported by some formats diff --git a/io/OBJReader.cs b/io/OBJReader.cs index 7f037598..48aa760a 100644 --- a/io/OBJReader.cs +++ b/io/OBJReader.cs @@ -75,7 +75,7 @@ public bool is_complex() - public class OBJReader : IMeshReader + [Serializable] public class OBJReader : IMeshReader { DVector vPositions; DVector vNormals; diff --git a/io/OBJWriter.cs b/io/OBJWriter.cs index 59708df7..d96510f7 100644 --- a/io/OBJWriter.cs +++ b/io/OBJWriter.cs @@ -13,7 +13,7 @@ namespace g3 /// [TODO] options to preserve vertex and triangle indices /// /// - public class OBJWriter : IMeshWriter + [Serializable] public class OBJWriter : IMeshWriter { // stream-opener. Override to write to something other than a file. public Func OpenStreamF = (sFilename) => { diff --git a/io/OFFWriter.cs b/io/OFFWriter.cs index aa322f5f..ba7db210 100644 --- a/io/OFFWriter.cs +++ b/io/OFFWriter.cs @@ -12,7 +12,7 @@ namespace g3 // Write OFF mesh format // https://en.wikipedia.org/wiki/OFF_(file_format) // - public class OFFWriter : IMeshWriter + [Serializable] public class OFFWriter : IMeshWriter { diff --git a/io/STLReader.cs b/io/STLReader.cs index 091561b6..f2706c05 100644 --- a/io/STLReader.cs +++ b/io/STLReader.cs @@ -27,10 +27,10 @@ namespace g3 /// DVector colors = Builder.Metadata[0][STLReader.PerTriAttribMetadataName] as DVector; /// (for DMesh3Builder, which is the only builder that supports Metadata) /// - public class STLReader : IMeshReader + [Serializable] public class STLReader : IMeshReader { - public enum Strategy + [Serializable] public enum Strategy { NoProcessing = 0, // return triangle soup IdenticalVertexWeld = 1, // merge identical vertices. Logically sensible but doesn't always work on ASCII STL. diff --git a/io/STLWriter.cs b/io/STLWriter.cs index 61c25455..ef8babc5 100644 --- a/io/STLWriter.cs +++ b/io/STLWriter.cs @@ -9,7 +9,7 @@ namespace g3 { - public class STLWriter : IMeshWriter + [Serializable] public class STLWriter : IMeshWriter { // entire data block for stl triangle, that we can directly convert to byte[] [StructLayout(LayoutKind.Sequential, Pack=1)] diff --git a/io/SVGWriter.cs b/io/SVGWriter.cs index ed6a0115..f809590a 100644 --- a/io/SVGWriter.cs +++ b/io/SVGWriter.cs @@ -7,12 +7,12 @@ namespace g3 { - public class SVGWriter + [Serializable] public class SVGWriter { public bool FlipY = true; - public struct Style { + [Serializable] public struct Style { public string fill; public string stroke; public float stroke_width; diff --git a/io/StandardMeshReader.cs b/io/StandardMeshReader.cs index d1e5b258..b6239235 100644 --- a/io/StandardMeshReader.cs +++ b/io/StandardMeshReader.cs @@ -18,7 +18,7 @@ public interface MeshFormatReader } - public class StandardMeshReader + [Serializable] public class StandardMeshReader { /// /// If the mesh format we are writing is text, then the OS will write in the number style @@ -246,7 +246,7 @@ private void on_warning(string message, object extra_data) // MeshFormatReader impl for OBJ - public class OBJFormatReader : MeshFormatReader + [Serializable] public class OBJFormatReader : MeshFormatReader { public List SupportedExtensions { get { return new List() { "obj" }; @@ -283,7 +283,7 @@ public IOReadResult ReadFile(Stream stream, IMeshBuilder builder, ReadOptions op // MeshFormatReader impl for STL - public class STLFormatReader : MeshFormatReader + [Serializable] public class STLFormatReader : MeshFormatReader { public List SupportedExtensions { get { return new List() { "stl" }; @@ -343,7 +343,7 @@ public IOReadResult ReadFile(Stream stream, IMeshBuilder builder, ReadOptions op // MeshFormatReader impl for OFF - public class OFFFormatReader : MeshFormatReader + [Serializable] public class OFFFormatReader : MeshFormatReader { public List SupportedExtensions { get { return new List() { "off" }; @@ -374,7 +374,7 @@ public IOReadResult ReadFile(Stream stream, IMeshBuilder builder, ReadOptions op // MeshFormatReader impl for g3mesh - public class BinaryG3FormatReader : MeshFormatReader + [Serializable] public class BinaryG3FormatReader : MeshFormatReader { public List SupportedExtensions { get { diff --git a/io/StandardMeshWriter.cs b/io/StandardMeshWriter.cs index 088fcc38..b9ca774f 100644 --- a/io/StandardMeshWriter.cs +++ b/io/StandardMeshWriter.cs @@ -16,7 +16,7 @@ namespace g3 /// Each of these is implemented in a separate Writer class, eg OBJWriter, STLWriter, etc /// /// - public class StandardMeshWriter : IDisposable + [Serializable] public class StandardMeshWriter : IDisposable { /// diff --git a/io/gSerialization.cs b/io/gSerialization.cs index eaac6169..83ed973d 100644 --- a/io/gSerialization.cs +++ b/io/gSerialization.cs @@ -573,7 +573,7 @@ public static void Restore(ref string[] s, BinaryReader reader) /// Then you can load this data via: /// SimpleStore s = SimpleStore.Restore(path) /// - public class SimpleStore + [Serializable] public class SimpleStore { // only ever append to this list! public List Meshes = new List(); diff --git a/math/AxisAlignedBox2d.cs b/math/AxisAlignedBox2d.cs index 07c9343f..4e323c1f 100644 --- a/math/AxisAlignedBox2d.cs +++ b/math/AxisAlignedBox2d.cs @@ -3,7 +3,7 @@ namespace g3 { - public struct AxisAlignedBox2d + [Serializable] public struct AxisAlignedBox2d { public Vector2d Min; public Vector2d Max; @@ -127,7 +127,7 @@ public void Add(double left, double right, double bottom, double top) { Max.x += right; Max.y += top; } - public enum ScaleMode { + [Serializable] public enum ScaleMode { ScaleRight, ScaleLeft, ScaleUp, diff --git a/math/AxisAlignedBox2f.cs b/math/AxisAlignedBox2f.cs index def2f86f..51084367 100644 --- a/math/AxisAlignedBox2f.cs +++ b/math/AxisAlignedBox2f.cs @@ -6,7 +6,7 @@ namespace g3 { - public struct AxisAlignedBox2f + [Serializable] public struct AxisAlignedBox2f { public Vector2f Min; public Vector2f Max; @@ -141,7 +141,7 @@ public void Add(float left, float right, float bottom, float top) { } - public enum ScaleMode { + [Serializable] public enum ScaleMode { ScaleRight, ScaleLeft, ScaleUp, diff --git a/math/AxisAlignedBox2i.cs b/math/AxisAlignedBox2i.cs index d5a74fcf..96a105e2 100644 --- a/math/AxisAlignedBox2i.cs +++ b/math/AxisAlignedBox2i.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct AxisAlignedBox2i : IComparable, IEquatable + [Serializable] public struct AxisAlignedBox2i : IComparable, IEquatable { public Vector2i Min; public Vector2i Max; diff --git a/math/AxisAlignedBox3d.cs b/math/AxisAlignedBox3d.cs index 021bdd60..1ce66713 100644 --- a/math/AxisAlignedBox3d.cs +++ b/math/AxisAlignedBox3d.cs @@ -2,7 +2,7 @@ namespace g3 { - public struct AxisAlignedBox3d : IComparable, IEquatable + [Serializable] public struct AxisAlignedBox3d : IComparable, IEquatable { public Vector3d Min; public Vector3d Max; diff --git a/math/AxisAlignedBox3f.cs b/math/AxisAlignedBox3f.cs index 356483ac..95de1bc7 100644 --- a/math/AxisAlignedBox3f.cs +++ b/math/AxisAlignedBox3f.cs @@ -6,7 +6,7 @@ namespace g3 { - public struct AxisAlignedBox3f : IComparable, IEquatable + [Serializable] public struct AxisAlignedBox3f : IComparable, IEquatable { public Vector3f Min; public Vector3f Max; diff --git a/math/AxisAlignedBox3i.cs b/math/AxisAlignedBox3i.cs index 16ee2656..506c56ba 100644 --- a/math/AxisAlignedBox3i.cs +++ b/math/AxisAlignedBox3i.cs @@ -3,7 +3,7 @@ namespace g3 { - public struct AxisAlignedBox3i : IComparable, IEquatable + [Serializable] public struct AxisAlignedBox3i : IComparable, IEquatable { public Vector3i Min; public Vector3i Max; diff --git a/math/Box2.cs b/math/Box2.cs index 08b59779..1e52e022 100644 --- a/math/Box2.cs +++ b/math/Box2.cs @@ -3,7 +3,7 @@ namespace g3 { // partially based on WildMagic5 Box2 - public struct Box2d + [Serializable] public struct Box2d { // A box has center C, axis directions U[0] and U[1] (perpendicular and // unit-length vectors), and extents e[0] and e[1] (nonnegative numbers). @@ -313,7 +313,7 @@ public static explicit operator Box2f(Box2d v) // partially based on WildMagic5 Box3 - public struct Box2f + [Serializable] public struct Box2f { // A box has center C, axis directions U[0] and U[1] (perpendicular and // unit-length vectors), and extents e[0] and e[1] (nonnegative numbers). diff --git a/math/Box3.cs b/math/Box3.cs index f0ab9ad3..e000c037 100644 --- a/math/Box3.cs +++ b/math/Box3.cs @@ -4,7 +4,7 @@ namespace g3 { // partially based on WildMagic5 Box3 - public struct Box3d + [Serializable] public struct Box3d { // A box has center C, axis directions U[0], U[1], and U[2] (mutually // perpendicular unit-length vectors), and extents e[0], e[1], and e[2] @@ -444,7 +444,7 @@ public static explicit operator Box3f(Box3d v) // partially based on WildMagic5 Box3 - public struct Box3f + [Serializable] public struct Box3f { // A box has center C, axis directions U[0], U[1], and U[2] (mutually // perpendicular unit-length vectors), and extents e[0], e[1], and e[2] diff --git a/math/Frame3f.cs b/math/Frame3f.cs index 8d9e1732..388bfc3e 100644 --- a/math/Frame3f.cs +++ b/math/Frame3f.cs @@ -6,7 +6,7 @@ namespace g3 { - public struct Frame3f + [Serializable] public struct Frame3f { Quaternionf rotation; Vector3f origin; diff --git a/math/IndexTypes.cs b/math/IndexTypes.cs index f3a0767f..8d97c60b 100644 --- a/math/IndexTypes.cs +++ b/math/IndexTypes.cs @@ -3,7 +3,7 @@ namespace g3 { - public struct Index3i : IComparable, IEquatable + [Serializable] public struct Index3i : IComparable, IEquatable { public int a; public int b; @@ -163,7 +163,7 @@ public override string ToString() { - public struct Index2i : IComparable, IEquatable + [Serializable] public struct Index2i : IComparable, IEquatable { public int a; public int b; @@ -309,7 +309,7 @@ public override string ToString() { - public struct Index4i + [Serializable] public struct Index4i { public int a; public int b; diff --git a/math/IndexUtil.cs b/math/IndexUtil.cs index 8891eb2d..c9018fad 100644 --- a/math/IndexUtil.cs +++ b/math/IndexUtil.cs @@ -3,7 +3,7 @@ namespace g3 { - public class IndexUtil + [Serializable] public class IndexUtil { // test if [a0,a1] and [b0,b1] are the same pair, ignoring order public static bool same_pair_unordered(int a0, int a1, int b0, int b1) diff --git a/math/Interval1d.cs b/math/Interval1d.cs index f9ebb729..c2b0a3c6 100644 --- a/math/Interval1d.cs +++ b/math/Interval1d.cs @@ -4,7 +4,7 @@ namespace g3 { // interval [a,b] on Real line. // TODO: should check that a <= b !! - public struct Interval1d + [Serializable] public struct Interval1d { public double a; public double b; diff --git a/math/Interval1i.cs b/math/Interval1i.cs index 87cc92fa..fb4f749c 100644 --- a/math/Interval1i.cs +++ b/math/Interval1i.cs @@ -9,7 +9,7 @@ namespace g3 // enumerate over the range of values (inclusive!!) // // TODO: should check that a <= b !! - public struct Interval1i : IEnumerable + [Serializable] public struct Interval1i : IEnumerable { public int a; public int b; diff --git a/math/Line2.cs b/math/Line2.cs index 58770c09..b4b5671d 100644 --- a/math/Line2.cs +++ b/math/Line2.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Line2d + [Serializable] public struct Line2d { public Vector2d Origin; public Vector2d Direction; @@ -111,7 +111,7 @@ public static explicit operator Line2f(Line2d v) } - public struct Line2f + [Serializable] public struct Line2f { public Vector2f Origin; public Vector2f Direction; diff --git a/math/Line3.cs b/math/Line3.cs index 115db674..0409b896 100644 --- a/math/Line3.cs +++ b/math/Line3.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Line3d + [Serializable] public struct Line3d { public Vector3d Origin; public Vector3d Direction; @@ -53,7 +53,7 @@ public static explicit operator Line3f(Line3d v) } - public struct Line3f + [Serializable] public struct Line3f { public Vector3f Origin; public Vector3f Direction; diff --git a/math/Matrix2d.cs b/math/Matrix2d.cs index 76c9c0ca..694137a4 100644 --- a/math/Matrix2d.cs +++ b/math/Matrix2d.cs @@ -3,7 +3,7 @@ namespace g3 { // some functions ported from WildMagic5 Matrix2 - public class Matrix2d + [Serializable] public class Matrix2d { public double m00, m01, m10, m11; diff --git a/math/Matrix2f.cs b/math/Matrix2f.cs index e79ecc9e..397edd26 100644 --- a/math/Matrix2f.cs +++ b/math/Matrix2f.cs @@ -3,7 +3,7 @@ namespace g3 { // some functions ported from WildMagic5 Matrix2 - public class Matrix2f + [Serializable] public class Matrix2f { public float m00, m01, m10, m11; diff --git a/math/Matrix3d.cs b/math/Matrix3d.cs index f0fd6395..d13509bb 100644 --- a/math/Matrix3d.cs +++ b/math/Matrix3d.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Matrix3d + [Serializable] public struct Matrix3d { public Vector3d Row0; public Vector3d Row1; diff --git a/math/Matrix3f.cs b/math/Matrix3f.cs index a14b7e44..665090e6 100644 --- a/math/Matrix3f.cs +++ b/math/Matrix3f.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Matrix3f + [Serializable] public struct Matrix3f { public Vector3f Row0; public Vector3f Row1; diff --git a/math/Plane3.cs b/math/Plane3.cs index 505adb01..945f621f 100644 --- a/math/Plane3.cs +++ b/math/Plane3.cs @@ -4,7 +4,7 @@ namespace g3 { //3D plane, based on WildMagic5 Wm5Plane3 class - public struct Plane3d + [Serializable] public struct Plane3d { public Vector3d Normal; public double Constant; @@ -63,7 +63,7 @@ public int WhichSide (Vector3d p) - public struct Plane3f + [Serializable] public struct Plane3f { public Vector3f Normal; public float Constant; diff --git a/math/PrimalQuery2d.cs b/math/PrimalQuery2d.cs index d73b310e..7f61a73a 100644 --- a/math/PrimalQuery2d.cs +++ b/math/PrimalQuery2d.cs @@ -245,7 +245,7 @@ public int ToCircumcircle(Vector2d test, int v0, int v1, int v2) // ORDER_COLLINEAR_LEFT when the line ordering is // ORDER_COLLINEAR_RIGHT when the line ordering is // ORDER_COLLINEAR_CONTAIN when the line ordering is - public enum OrderType + [Serializable] public enum OrderType { ORDER_Q0_EQUALS_Q1, ORDER_P_EQUALS_Q0, diff --git a/math/Quaterniond.cs b/math/Quaterniond.cs index 555d49cb..cc8c1c30 100644 --- a/math/Quaterniond.cs +++ b/math/Quaterniond.cs @@ -8,7 +8,7 @@ namespace g3 { // mostly ported from WildMagic5 Wm5Quaternion, from geometrictools.com - public struct Quaterniond + [Serializable] public struct Quaterniond { // note: in Wm5 version, this is a 4-element array stored in order (w,x,y,z). public double x, y, z, w; diff --git a/math/Quaternionf.cs b/math/Quaternionf.cs index 7e6c7872..d29c0fbf 100644 --- a/math/Quaternionf.cs +++ b/math/Quaternionf.cs @@ -8,7 +8,7 @@ namespace g3 { // mostly ported from WildMagic5 Wm5Quaternion, from geometrictools.com - public struct Quaternionf : IComparable, IEquatable + [Serializable] public struct Quaternionf : IComparable, IEquatable { // note: in Wm5 version, this is a 4-element array stored in order (w,x,y,z). public float x, y, z, w; diff --git a/math/Query2.cs b/math/Query2.cs index 2540f8b8..1a08656f 100644 --- a/math/Query2.cs +++ b/math/Query2.cs @@ -6,7 +6,7 @@ namespace g3 // Port of Wm5 Query/Query2 from WildMagic5 library by David Eberly / geometrictools.com - public enum QueryNumberType + [Serializable] public enum QueryNumberType { QT_DOUBLE = 0, QT_INT64 = 1, @@ -34,7 +34,7 @@ public interface Query2 - public class Query2d : QueryBase, Query2 + [Serializable] public class Query2d : QueryBase, Query2 { protected IList mVertices; @@ -209,7 +209,7 @@ public double Det3(double x0, double y0, double z0, double x1, double y1, double /// /// Port of WildMagic5 Query class /// - public class QueryBase + [Serializable] public class QueryBase { // Support for ordering a set of unique indices into the vertex pool. On diff --git a/math/Query2Integer.cs b/math/Query2Integer.cs index eb3c2986..3c7e659b 100644 --- a/math/Query2Integer.cs +++ b/math/Query2Integer.cs @@ -12,7 +12,7 @@ namespace g3 /// Note that input Vector2d values are directly cast to int64 - you must /// scale them to suitable coordinates yourself! /// - public class Query2Int64 : Query2d + [Serializable] public class Query2Int64 : Query2d { public Query2Int64(IList Vertices) : base(Vertices) diff --git a/math/QueryTuple2d.cs b/math/QueryTuple2d.cs index 1343cd54..fff0f100 100644 --- a/math/QueryTuple2d.cs +++ b/math/QueryTuple2d.cs @@ -4,7 +4,7 @@ namespace g3 { // variant of Wm5::Query2, for special case of 3 points. This is used in // IntrTriangle3Triangle3, to avoid allocating arrays - public class QueryTuple2d + [Serializable] public class QueryTuple2d { Vector2dTuple3 mVertices; diff --git a/math/Ray3.cs b/math/Ray3.cs index 55f1eb61..231eb911 100644 --- a/math/Ray3.cs +++ b/math/Ray3.cs @@ -9,7 +9,7 @@ namespace g3 { - public struct Ray3d + [Serializable] public struct Ray3d { public Vector3d Origin; public Vector3d Direction; @@ -88,7 +88,7 @@ public static explicit operator Ray(Ray3d r) - public struct Ray3f + [Serializable] public struct Ray3f { public Vector3f Origin; public Vector3f Direction; diff --git a/math/ScalarMap.cs b/math/ScalarMap.cs index 7729de7d..6b74ea2e 100644 --- a/math/ScalarMap.cs +++ b/math/ScalarMap.cs @@ -7,7 +7,7 @@ namespace g3 /// Scalar version of a ColorMap (ie interpolate between sample points) /// [TODO] could we make this a template? /// - public class ScalarMap + [Serializable] public class ScalarMap { struct Sample { diff --git a/math/Segment2.cs b/math/Segment2.cs index 9272599b..feda81ea 100644 --- a/math/Segment2.cs +++ b/math/Segment2.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Segment2d : IParametricCurve2d + [Serializable] public struct Segment2d : IParametricCurve2d { // Center-direction-extent representation. public Vector2d Center; @@ -257,7 +257,7 @@ public bool Intersects(Segment2d seg2, double dotThresh = double.Epsilon, double - public struct Segment2f + [Serializable] public struct Segment2f { // Center-direction-extent representation. public Vector2f Center; @@ -369,7 +369,7 @@ public static float FastDistanceSquared(ref Vector2f a, ref Vector2f b, ref Vect - public class Segment2dBox + [Serializable] public class Segment2dBox { public Segment2d Segment; diff --git a/math/Segment3.cs b/math/Segment3.cs index 4583ef90..5991c557 100644 --- a/math/Segment3.cs +++ b/math/Segment3.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Segment3d : IParametricCurve3d + [Serializable] public struct Segment3d : IParametricCurve3d { // Center-direction-extent representation. // Extent is half length of segment @@ -145,7 +145,7 @@ public IParametricCurve3d Clone() { - public struct Segment3f + [Serializable] public struct Segment3f { // Center-direction-extent representation. // Extent is half length of segment diff --git a/math/TransformSequence.cs b/math/TransformSequence.cs index a8197e69..25d45898 100644 --- a/math/TransformSequence.cs +++ b/math/TransformSequence.cs @@ -14,7 +14,7 @@ namespace g3 /// Use the Append() functions to add different transform types, and the TransformX() /// to apply the sequence /// - public class TransformSequence + [Serializable] public class TransformSequence { enum XFormType { diff --git a/math/TransformSequence2.cs b/math/TransformSequence2.cs index b4a843b5..daa4380d 100644 --- a/math/TransformSequence2.cs +++ b/math/TransformSequence2.cs @@ -23,7 +23,7 @@ public interface ITransform2 /// Use the Append() functions to add different transform types, and the TransformX() /// to apply the sequence /// - public class TransformSequence2 : ITransform2 + [Serializable] public class TransformSequence2 : ITransform2 { enum XFormType { diff --git a/math/Triangle2.cs b/math/Triangle2.cs index 0b6870d3..916fa517 100644 --- a/math/Triangle2.cs +++ b/math/Triangle2.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Triangle2d + [Serializable] public struct Triangle2d { public Vector2d V0, V1, V2; @@ -42,7 +42,7 @@ public static explicit operator Triangle2f(Triangle2d v) - public struct Triangle2f + [Serializable] public struct Triangle2f { public Vector2f V0, V1, V2; diff --git a/math/Triangle3.cs b/math/Triangle3.cs index 5500c98a..496b1fa2 100644 --- a/math/Triangle3.cs +++ b/math/Triangle3.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Triangle3d + [Serializable] public struct Triangle3d { public Vector3d V0, V1, V2; @@ -57,7 +57,7 @@ public static explicit operator Triangle3f(Triangle3d v) - public struct Triangle3f + [Serializable] public struct Triangle3f { public Vector3f V0, V1, V2; diff --git a/math/Vector2d.cs b/math/Vector2d.cs index 07f89673..872b9c57 100644 --- a/math/Vector2d.cs +++ b/math/Vector2d.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct Vector2d : IComparable, IEquatable + [Serializable] public struct Vector2d : IComparable, IEquatable { public double x; public double y; @@ -301,7 +301,7 @@ public static explicit operator UnityEngine.Vector2(Vector2d v) // from WildMagic5 Vector2, used in ConvexHull2 - public struct Information + [Serializable] public struct Information { // The intrinsic dimension of the input set. The parameter 'epsilon' // to the GetInformation function is used to provide a tolerance when diff --git a/math/Vector2f.cs b/math/Vector2f.cs index 2d63e73c..bab9bbbb 100644 --- a/math/Vector2f.cs +++ b/math/Vector2f.cs @@ -9,7 +9,7 @@ namespace g3 { - public struct Vector2f : IComparable, IEquatable + [Serializable] public struct Vector2f : IComparable, IEquatable { public float x; public float y; diff --git a/math/Vector2i.cs b/math/Vector2i.cs index 72d22f30..66cfbc08 100644 --- a/math/Vector2i.cs +++ b/math/Vector2i.cs @@ -2,7 +2,7 @@ namespace g3 { - public struct Vector2i : IComparable, IEquatable + [Serializable] public struct Vector2i : IComparable, IEquatable { public int x; public int y; @@ -140,7 +140,7 @@ public override string ToString() - public struct Vector2l : IComparable, IEquatable + [Serializable] public struct Vector2l : IComparable, IEquatable { public long x; public long y; diff --git a/math/Vector3d.cs b/math/Vector3d.cs index 044ef93b..a346dd6f 100644 --- a/math/Vector3d.cs +++ b/math/Vector3d.cs @@ -8,7 +8,7 @@ namespace g3 { - public struct Vector3d : IComparable, IEquatable + [Serializable] public struct Vector3d : IComparable, IEquatable { public double x; public double y; diff --git a/math/Vector3f.cs b/math/Vector3f.cs index a0116630..52cf6478 100644 --- a/math/Vector3f.cs +++ b/math/Vector3f.cs @@ -8,7 +8,7 @@ namespace g3 { - public struct Vector3f : IComparable, IEquatable + [Serializable] public struct Vector3f : IComparable, IEquatable { public float x; public float y; diff --git a/math/Vector3i.cs b/math/Vector3i.cs index 26e4f6b5..d41e9d2f 100644 --- a/math/Vector3i.cs +++ b/math/Vector3i.cs @@ -10,7 +10,7 @@ namespace g3 /// Unfortunately I can't see a way to do this w/o so much duplication...we could /// have .x/.y/.z accessors but that is much less efficient... /// - public struct Vector3i : IComparable, IEquatable + [Serializable] public struct Vector3i : IComparable, IEquatable { public int x; public int y; diff --git a/math/Vector4d.cs b/math/Vector4d.cs index 1965e72b..77182ff6 100644 --- a/math/Vector4d.cs +++ b/math/Vector4d.cs @@ -8,7 +8,7 @@ namespace g3 { - public struct Vector4d : IComparable, IEquatable + [Serializable] public struct Vector4d : IComparable, IEquatable { public double x; public double y; diff --git a/math/Vector4f.cs b/math/Vector4f.cs index 777d8049..32d48aa6 100644 --- a/math/Vector4f.cs +++ b/math/Vector4f.cs @@ -8,7 +8,7 @@ namespace g3 { - public struct Vector4f : IComparable, IEquatable + [Serializable] public struct Vector4f : IComparable, IEquatable { public float x; public float y; diff --git a/math/VectorTuple.cs b/math/VectorTuple.cs index 993646b2..3c5ab2ef 100644 --- a/math/VectorTuple.cs +++ b/math/VectorTuple.cs @@ -6,7 +6,7 @@ namespace g3 // (which C# does not support, but is common in C++ code) - public struct Vector3dTuple2 + [Serializable] public struct Vector3dTuple2 { public Vector3d V0, V1; @@ -22,7 +22,7 @@ public Vector3d this[int key] { } - public struct Vector3dTuple3 + [Serializable] public struct Vector3dTuple3 { public Vector3d V0, V1, V2; @@ -40,7 +40,7 @@ public Vector3d this[int key] - public struct Vector3fTuple3 + [Serializable] public struct Vector3fTuple3 { public Vector3f V0, V1, V2; @@ -59,7 +59,7 @@ public Vector3f this[int key] - public struct Vector2dTuple2 + [Serializable] public struct Vector2dTuple2 { public Vector2d V0, V1; @@ -76,7 +76,7 @@ public Vector2d this[int key] } - public struct Vector2dTuple3 + [Serializable] public struct Vector2dTuple3 { public Vector2d V0, V1, V2; @@ -93,7 +93,7 @@ public Vector2d this[int key] } - public struct Vector2dTuple4 + [Serializable] public struct Vector2dTuple4 { public Vector2d V0, V1, V2, V3; diff --git a/mesh/DMesh3.cs b/mesh/DMesh3.cs index 794b7dda..9a2f1e23 100644 --- a/mesh/DMesh3.cs +++ b/mesh/DMesh3.cs @@ -7,7 +7,7 @@ namespace g3 { - public enum MeshResult + [Serializable] public enum MeshResult { Ok = 0, Failed_NotAVertex = 1, @@ -39,7 +39,7 @@ public enum MeshResult [Flags] - public enum MeshComponents + [Serializable] public enum MeshComponents { None = 0, VertexNormals = 1, @@ -50,7 +50,7 @@ public enum MeshComponents } [Flags] - public enum MeshHints + [Serializable] public enum MeshHints { None = 0, IsCompact = 1 @@ -198,7 +198,7 @@ public DMesh3(IMesh copy, MeshHints hints, MeshComponents flags) : } - public struct CompactInfo + [Serializable] public struct CompactInfo { public IIndexMap MapV; } diff --git a/mesh/DMesh3Builder.cs b/mesh/DMesh3Builder.cs index 15581606..85c9a5d8 100644 --- a/mesh/DMesh3Builder.cs +++ b/mesh/DMesh3Builder.cs @@ -5,9 +5,9 @@ namespace g3 { - public class DMesh3Builder : IMeshBuilder + [Serializable] public class DMesh3Builder : IMeshBuilder { - public enum AddTriangleFailBehaviors + [Serializable] public enum AddTriangleFailBehaviors { DiscardTriangle = 0, DuplicateAllVertices = 1 diff --git a/mesh/DMesh3Changes.cs b/mesh/DMesh3Changes.cs index 3f673d57..03685384 100644 --- a/mesh/DMesh3Changes.cs +++ b/mesh/DMesh3Changes.cs @@ -9,7 +9,7 @@ namespace g3 /// Mesh change for vertex deformations. Currently minimal support for initializing buffers. /// AppendNewVertex() can be used to accumulate modified vertices and their initial positions. /// - public class ModifyVerticesMeshChange + [Serializable] public class ModifyVerticesMeshChange { public DVector ModifiedV; public DVector OldPositions, NewPositions; @@ -115,7 +115,7 @@ void initialize_buffers(DMesh3 mesh, MeshComponents components) /// Mesh change for full-mesh vertex deformations - more efficient than ModifyVerticesMeshChange. /// Note that this does not enforce that vertex count does not change! /// - public class SetVerticesMeshChange + [Serializable] public class SetVerticesMeshChange { public DVector OldPositions, NewPositions; public DVector OldNormals, NewNormals; @@ -175,7 +175,7 @@ public void Revert(DMesh3 mesh) /// Vertex and Triangle IDs will be restored on Revert() /// Currently does *not* restore the same EdgeIDs /// - public class RemoveTrianglesMeshChange + [Serializable] public class RemoveTrianglesMeshChange { protected DVector RemovedV; protected DVector Positions; @@ -360,7 +360,7 @@ void initialize_buffers(DMesh3 mesh) /// Vertex and Triangle IDs will be restored on Revert() /// Currently does *not* restore the same EdgeIDs /// - public class AddTrianglesMeshChange + [Serializable] public class AddTrianglesMeshChange { protected DVector AddedV; protected DVector Positions; diff --git a/mesh/DMesh3_edge_operators.cs b/mesh/DMesh3_edge_operators.cs index 1df7b540..67e43988 100644 --- a/mesh/DMesh3_edge_operators.cs +++ b/mesh/DMesh3_edge_operators.cs @@ -256,7 +256,7 @@ public virtual MeshResult SetTriangle(int tID, Index3i newv, bool bRemoveIsolate - public struct EdgeSplitInfo { + [Serializable] public struct EdgeSplitInfo { public bool bIsBoundary; public int vNew; public int eNewBN; // new edge [vNew,vB] (original was AB) @@ -440,7 +440,7 @@ public MeshResult SplitEdge(int eab, out EdgeSplitInfo split, double split_t = 0 - public struct EdgeFlipInfo { + [Serializable] public struct EdgeFlipInfo { public int eID; public int v0,v1; public int ov0,ov1; @@ -552,7 +552,7 @@ void check_edge(int e) { } - public struct EdgeCollapseInfo { + [Serializable] public struct EdgeCollapseInfo { public int vKept; public int vRemoved; public bool bIsBoundary; @@ -791,7 +791,7 @@ public MeshResult CollapseEdge(int vKeep, int vRemove, out EdgeCollapseInfo coll - public struct MergeEdgesInfo + [Serializable] public struct MergeEdgesInfo { public int eKept; public int eRemoved; @@ -1003,7 +1003,7 @@ public MeshResult MergeEdges(int eKeep, int eDiscard, out MergeEdgesInfo merge_i - public struct PokeTriangleInfo + [Serializable] public struct PokeTriangleInfo { public int new_vid; public int new_t1, new_t2; diff --git a/mesh/DSubmesh3.cs b/mesh/DSubmesh3.cs index b3ec35af..4f1c6d15 100644 --- a/mesh/DSubmesh3.cs +++ b/mesh/DSubmesh3.cs @@ -9,7 +9,7 @@ namespace g3 - public class DSubmesh3 + [Serializable] public class DSubmesh3 { public DMesh3 BaseMesh; public DMesh3 SubMesh; diff --git a/mesh/DSubmesh3Set.cs b/mesh/DSubmesh3Set.cs index fd845f3b..54d727a6 100644 --- a/mesh/DSubmesh3Set.cs +++ b/mesh/DSubmesh3Set.cs @@ -14,7 +14,7 @@ namespace g3 /// that returns the triangle index list for a given key. The set of DSubmesh3 /// objects are computed on construction. /// - public class DSubmesh3Set : IEnumerable + [Serializable] public class DSubmesh3Set : IEnumerable { public DMesh3 Mesh; diff --git a/mesh/EdgeLoop.cs b/mesh/EdgeLoop.cs index e83d51e8..b76bbbab 100644 --- a/mesh/EdgeLoop.cs +++ b/mesh/EdgeLoop.cs @@ -10,7 +10,7 @@ namespace g3 /// /// If all you have are the vertices, use EdgeLoop.VertexLoopToEdgeLoop() to construct an EdgeLoop /// - public class EdgeLoop + [Serializable] public class EdgeLoop { public DMesh3 Mesh; diff --git a/mesh/EdgeLoopRemesher.cs b/mesh/EdgeLoopRemesher.cs index 54331b1a..99ec45cd 100644 --- a/mesh/EdgeLoopRemesher.cs +++ b/mesh/EdgeLoopRemesher.cs @@ -15,7 +15,7 @@ namespace g3 /// [TODO] local-smoothing impl is not very efficient. Should not be necessary to /// rebuild nbrhood each time if we are not changing it. /// - public class EdgeLoopRemesher : Remesher + [Serializable] public class EdgeLoopRemesher : Remesher { public EdgeLoop InputLoop; public EdgeLoop OutputLoop; diff --git a/mesh/EdgeSpan.cs b/mesh/EdgeSpan.cs index f55e4835..9aa41397 100644 --- a/mesh/EdgeSpan.cs +++ b/mesh/EdgeSpan.cs @@ -8,7 +8,7 @@ namespace g3 /// An EdgeSpan is a continous set of edges in a Mesh that is *not* closed /// (that would be an EdgeLoop) /// - public class EdgeSpan + [Serializable] public class EdgeSpan { public DMesh3 Mesh; diff --git a/mesh/FaceGroupOptimizer.cs b/mesh/FaceGroupOptimizer.cs index 782ae743..fc58d179 100644 --- a/mesh/FaceGroupOptimizer.cs +++ b/mesh/FaceGroupOptimizer.cs @@ -10,7 +10,7 @@ namespace g3 /// This involves flipping triangles between groups, and/or assigning to "background" group. /// Also has Dilate/Contract functions to grow/shrink groups in various ways. /// - public class FaceGroupOptimizer + [Serializable] public class FaceGroupOptimizer { // cannot change this w/o updating GetEnumeratorF DMesh3 mesh; diff --git a/mesh/IMesh.cs b/mesh/IMesh.cs index 11b913f1..2efa9b72 100644 --- a/mesh/IMesh.cs +++ b/mesh/IMesh.cs @@ -61,7 +61,7 @@ public interface IDeformableMesh : IMesh /* * Abstracts construction of meshes, so that we can construct different types, etc */ - public struct NewVertexInfo + [Serializable] public struct NewVertexInfo { public Vector3d v; public Vector3f n, c; diff --git a/mesh/MeshCaches.cs b/mesh/MeshCaches.cs index 25375a3d..8d699342 100644 --- a/mesh/MeshCaches.cs +++ b/mesh/MeshCaches.cs @@ -9,7 +9,7 @@ namespace g3 /* * Basic cache of per-triangle information for a DMesh3 */ - public class MeshTriInfoCache + [Serializable] public class MeshTriInfoCache { public DVector Centroids; public DVector Normals; diff --git a/mesh/MeshConstraints.cs b/mesh/MeshConstraints.cs index 79a856b1..9c5aae82 100644 --- a/mesh/MeshConstraints.cs +++ b/mesh/MeshConstraints.cs @@ -6,7 +6,7 @@ namespace g3 { [Flags] - public enum EdgeRefineFlags + [Serializable] public enum EdgeRefineFlags { NoConstraint = 0, NoFlip = 1, @@ -20,7 +20,7 @@ public enum EdgeRefineFlags } - public struct EdgeConstraint + [Serializable] public struct EdgeConstraint { EdgeRefineFlags refineFlags; public IProjectionTarget Target; // edge is associated with this projection Target. @@ -69,7 +69,7 @@ public bool IsUnconstrained { - public struct VertexConstraint + [Serializable] public struct VertexConstraint { public bool Fixed; public int FixedSetID; // in Remesher, we can allow two Fixed vertices with @@ -104,7 +104,7 @@ public VertexConstraint(IProjectionTarget target) - public class MeshConstraints + [Serializable] public class MeshConstraints { Dictionary Edges = new Dictionary(); diff --git a/mesh/MeshDecomposition.cs b/mesh/MeshDecomposition.cs index 9c32a293..49bf4af8 100644 --- a/mesh/MeshDecomposition.cs +++ b/mesh/MeshDecomposition.cs @@ -19,7 +19,7 @@ public interface IMeshComponentManager // [TODO] // - build strategy using AABB tree traversal // - option to store components here (currently if client does not hold, we are discarding) - public class MeshDecomposition + [Serializable] public class MeshDecomposition { DMesh3 mesh; @@ -32,7 +32,7 @@ public class MeshDecomposition public IMeshComponentManager Manager { set; get; } - public struct Component + [Serializable] public struct Component { public int id; // probably linear index diff --git a/mesh/MeshEditor.cs b/mesh/MeshEditor.cs index 939c7cc3..d8665c55 100644 --- a/mesh/MeshEditor.cs +++ b/mesh/MeshEditor.cs @@ -13,7 +13,7 @@ namespace g3 // - (?) // // - public class MeshEditor + [Serializable] public class MeshEditor { public DMesh3 Mesh; @@ -667,7 +667,7 @@ public int DisconnectAllBowties(int nMaxIters = 10) // This enum/argument controls the behavior. // However, fundamentally this kind of problem should be handled upstream!! For example by not trying // to remesh areas that contain nonmanifold geometry... - public enum DuplicateTriBehavior + [Serializable] public enum DuplicateTriBehavior { AssertContinue, // check will not be done in Release! AssertAbort, UseExisting, Replace diff --git a/mesh/MeshMeasurements.cs b/mesh/MeshMeasurements.cs index 4a7cf0c5..b6a5b314 100644 --- a/mesh/MeshMeasurements.cs +++ b/mesh/MeshMeasurements.cs @@ -416,7 +416,7 @@ public static Interval1i ExtremeVertices(DMesh3 mesh, Vector3d axis, Func Normals; @@ -18,7 +18,7 @@ public class MeshNormals - public enum NormalsTypes + [Serializable] public enum NormalsTypes { Vertex_OneRingFaceAverage_AreaWeighted } diff --git a/mesh/MeshPointSets.cs b/mesh/MeshPointSets.cs index bc866095..a26787fa 100644 --- a/mesh/MeshPointSets.cs +++ b/mesh/MeshPointSets.cs @@ -9,7 +9,7 @@ namespace g3 /// /// Present mesh edge midpoints as a point set /// - public class MeshEdgeMidpoints : IPointSet + [Serializable] public class MeshEdgeMidpoints : IPointSet { public MeshEdgeMidpoints(DMesh3 mesh) { @@ -50,7 +50,7 @@ public int Timestamp { /// /// Present mesh boundary-edge midpoints as a point set /// - public class MeshBoundaryEdgeMidpoints : IPointSet + [Serializable] public class MeshBoundaryEdgeMidpoints : IPointSet { public MeshBoundaryEdgeMidpoints(DMesh3 mesh) { diff --git a/mesh/MeshRefinerBase.cs b/mesh/MeshRefinerBase.cs index 96ea5075..7c194829 100644 --- a/mesh/MeshRefinerBase.cs +++ b/mesh/MeshRefinerBase.cs @@ -5,7 +5,7 @@ namespace g3 { - public class MeshRefinerBase + [Serializable] public class MeshRefinerBase { protected DMesh3 mesh; protected MeshConstraints constraints = null; diff --git a/mesh/MeshUVSet.cs b/mesh/MeshUVSet.cs index 86ac480d..dfd6294d 100644 --- a/mesh/MeshUVSet.cs +++ b/mesh/MeshUVSet.cs @@ -7,7 +7,7 @@ namespace g3 // Standalone UV mesh // (mainly we are using this as a UV layer for an existing 3D Mesh, so the assumption // is that TriangleUVs has the same # of triangles as that mesh...) - public class DenseUVMesh + [Serializable] public class DenseUVMesh { public DVector UVs; public DVector TriangleUVs; diff --git a/mesh/NTMesh3.cs b/mesh/NTMesh3.cs index 145b585e..8ba8840a 100644 --- a/mesh/NTMesh3.cs +++ b/mesh/NTMesh3.cs @@ -1258,7 +1258,7 @@ public MeshResult RemoveTriangle(int tID, bool bRemoveIsolatedVertices = true) - public struct EdgeSplitInfo + [Serializable] public struct EdgeSplitInfo { public bool bIsBoundary; public int vNew; @@ -1385,7 +1385,7 @@ public MeshResult SplitEdge(int eab, out EdgeSplitInfo split) - public struct PokeTriangleInfo + [Serializable] public struct PokeTriangleInfo { public int new_vid; public int new_t1, new_t2; diff --git a/mesh/Reducer.cs b/mesh/Reducer.cs index 99757e6f..426b692a 100644 --- a/mesh/Reducer.cs +++ b/mesh/Reducer.cs @@ -10,7 +10,7 @@ namespace g3 /// Mesh Simplication - implementation of Garland & Heckbert Quadric Error Metric (QEM) Simplification /// /// - public class Reducer : MeshRefinerBase + [Serializable] public class Reducer : MeshRefinerBase { protected IProjectionTarget target = null; @@ -771,7 +771,7 @@ protected virtual void end_collapse() { /// - vector b /// - constant c /// - public struct QuadricError { + [Serializable] public struct QuadricError { public double Axx, Axy, Axz, Ayy, Ayz, Azz; public double bx, by, bz; public double c; diff --git a/mesh/RegionRemesher.cs b/mesh/RegionRemesher.cs index 22f81e04..3df74011 100644 --- a/mesh/RegionRemesher.cs +++ b/mesh/RegionRemesher.cs @@ -6,7 +6,7 @@ namespace g3 { - public class RegionRemesher : Remesher + [Serializable] public class RegionRemesher : Remesher { public DMesh3 BaseMesh; public DSubmesh3 Region; @@ -157,7 +157,7 @@ public bool BackPropropagate(bool bAllowSubmeshRepairs = true) [Flags] - public enum QuickRemeshFlags + [Serializable] public enum QuickRemeshFlags { NoFlags = 0, PreventNormalFlips = 1 diff --git a/mesh/Remesher.cs b/mesh/Remesher.cs index 4f784eba..24a2e06d 100644 --- a/mesh/Remesher.cs +++ b/mesh/Remesher.cs @@ -6,7 +6,7 @@ namespace g3 { - public class Remesher : MeshRefinerBase + [Serializable] public class Remesher : MeshRefinerBase { IProjectionTarget target = null; @@ -33,7 +33,7 @@ public enum SmoothTypes { // Sometimes we need to have very granular control over what happens to // specific vertices. This function allows client to specify such behavior. // Somewhat redundant w/ VertexConstraints, but simpler to code. - [Flags] public enum VertexControl + [Flags][Serializable] public enum VertexControl { AllowAll = 0, NoSmooth = 1, @@ -49,7 +49,7 @@ [Flags] public enum VertexControl public List DebugEdges = new List(); // if Target is set, we can project onto it in different ways - public enum TargetProjectionMode + [Serializable] public enum TargetProjectionMode { NoProjection, // disable projection AfterRefinement, // do all projection after the refine/smooth pass diff --git a/mesh/RemesherPro.cs b/mesh/RemesherPro.cs index 53cf6f51..fcf4028e 100644 --- a/mesh/RemesherPro.cs +++ b/mesh/RemesherPro.cs @@ -20,7 +20,7 @@ namespace gs /// - TrackedProjectionPass() same /// /// - public class RemesherPro : Remesher + [Serializable] public class RemesherPro : Remesher { public bool UseFaceAlignedProjection = false; diff --git a/mesh/SimpleMesh.cs b/mesh/SimpleMesh.cs index 404a6f4b..fbc6dfa6 100644 --- a/mesh/SimpleMesh.cs +++ b/mesh/SimpleMesh.cs @@ -6,7 +6,7 @@ namespace g3 { - public class SimpleMesh : IDeformableMesh + [Serializable] public class SimpleMesh : IDeformableMesh { public DVector Vertices; public DVector Normals; @@ -516,7 +516,7 @@ public unsafe void GetFaceGroupsBuffer(int* pBuffer) - public class SimpleMeshBuilder : IMeshBuilder + [Serializable] public class SimpleMeshBuilder : IMeshBuilder { public List Meshes; public List Materials; diff --git a/mesh/SimpleQuadMesh.cs b/mesh/SimpleQuadMesh.cs index 12a9823a..ae3e94c4 100644 --- a/mesh/SimpleQuadMesh.cs +++ b/mesh/SimpleQuadMesh.cs @@ -11,7 +11,7 @@ namespace g3 /// use static WriteOBJ() to save. No loading, for now. /// /// - public class SimpleQuadMesh + [Serializable] public class SimpleQuadMesh { public DVector Vertices; public DVector Normals; diff --git a/mesh_generators/ArrowGenerators.cs b/mesh_generators/ArrowGenerators.cs index fa63bed1..ab545a9f 100644 --- a/mesh_generators/ArrowGenerators.cs +++ b/mesh_generators/ArrowGenerators.cs @@ -6,7 +6,7 @@ namespace g3 { // radially-symmetric 3D arrow - public class Radial3DArrowGenerator : VerticalGeneralizedCylinderGenerator + [Serializable] public class Radial3DArrowGenerator : VerticalGeneralizedCylinderGenerator { public float StickRadius = 0.5f; public float StickLength = 1.0f; diff --git a/mesh_generators/BoxGenerators.cs b/mesh_generators/BoxGenerators.cs index dc2e1580..f00fa437 100644 --- a/mesh_generators/BoxGenerators.cs +++ b/mesh_generators/BoxGenerators.cs @@ -7,7 +7,7 @@ namespace g3 /// /// Generate a minimal box /// - public class TrivialBox3Generator : MeshGenerator + [Serializable] public class TrivialBox3Generator : MeshGenerator { public Box3d Box = Box3d.UnitZeroCentered; public bool NoSharedVertices = false; @@ -68,7 +68,7 @@ public override MeshGenerator Generate() /// with EdgeVertices verts along each edge. /// [TODO] allow varying EdgeVertices in each dimension (tricky...) /// - public class GridBox3Generator : MeshGenerator + [Serializable] public class GridBox3Generator : MeshGenerator { public Box3d Box = Box3d.UnitZeroCentered; public int EdgeVertices = 8; diff --git a/mesh_generators/CylinderGenerators.cs b/mesh_generators/CylinderGenerators.cs index 4a899cfd..2d609361 100644 --- a/mesh_generators/CylinderGenerators.cs +++ b/mesh_generators/CylinderGenerators.cs @@ -6,7 +6,7 @@ namespace g3 { // generate a cylinder - public class OpenCylinderGenerator : MeshGenerator + [Serializable] public class OpenCylinderGenerator : MeshGenerator { public float BaseRadius = 1.0f; public float TopRadius = 1.0f; @@ -69,7 +69,7 @@ override public MeshGenerator Generate() /// No subdivisions along top/base rings or height steps. /// cylinder triangles have groupid = 1, top cap = 2, bottom cap = 3, wedge faces 5 and 6 /// - public class CappedCylinderGenerator : MeshGenerator + [Serializable] public class CappedCylinderGenerator : MeshGenerator { public float BaseRadius = 1.0f; public float TopRadius = 1.0f; @@ -206,7 +206,7 @@ override public MeshGenerator Generate() // This causes the normals to look...weird. // For the conical region, we use the planar disc parameterization (ie tip at .5,.5) rather than // a cylinder-like projection - public class ConeGenerator : MeshGenerator + [Serializable] public class ConeGenerator : MeshGenerator { public float BaseRadius = 1.0f; public float Height = 1.0f; @@ -321,7 +321,7 @@ override public MeshGenerator Generate() - public class VerticalGeneralizedCylinderGenerator : MeshGenerator + [Serializable] public class VerticalGeneralizedCylinderGenerator : MeshGenerator { public CircularSection[] Sections; public int Slices = 16; diff --git a/mesh_generators/DiscGenerators.cs b/mesh_generators/DiscGenerators.cs index 057d8769..865db9e1 100644 --- a/mesh_generators/DiscGenerators.cs +++ b/mesh_generators/DiscGenerators.cs @@ -6,7 +6,7 @@ namespace g3 { // generate a triangle fan, no subdvisions - public class TrivialDiscGenerator : MeshGenerator + [Serializable] public class TrivialDiscGenerator : MeshGenerator { public float Radius = 1.0f; public float StartAngleDeg = 0.0f; @@ -56,7 +56,7 @@ override public MeshGenerator Generate() // generate a triangle fan, no subdvisions - public class PuncturedDiscGenerator : MeshGenerator + [Serializable] public class PuncturedDiscGenerator : MeshGenerator { public float OuterRadius = 1.0f; public float InnerRadius = 0.5f; diff --git a/mesh_generators/GenCylGenerators.cs b/mesh_generators/GenCylGenerators.cs index 49c5996a..2453fe13 100644 --- a/mesh_generators/GenCylGenerators.cs +++ b/mesh_generators/GenCylGenerators.cs @@ -20,7 +20,7 @@ namespace g3 /// vertex normals /// /// - public class TubeGenerator : MeshGenerator + [Serializable] public class TubeGenerator : MeshGenerator { public List Vertices; public Polygon2d Polygon; diff --git a/mesh_generators/MarchingCubes.cs b/mesh_generators/MarchingCubes.cs index fdf850ff..f4de0360 100644 --- a/mesh_generators/MarchingCubes.cs +++ b/mesh_generators/MarchingCubes.cs @@ -17,7 +17,7 @@ namespace g3 /// [TODO] hash table for edge vtx-indices instead, like old polygonizer? (how did we index edges?!?) /// /// - public class MarchingCubes + [Serializable] public class MarchingCubes { /// /// this is the function we will evaluate @@ -49,7 +49,7 @@ public class MarchingCubes public bool ParallelCompute = true; - public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } + [Serializable] public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } /// /// Which rootfinding method will be used to converge on surface along edges diff --git a/mesh_generators/MarchingCubesPro.cs b/mesh_generators/MarchingCubesPro.cs index 60f3da0a..0d181c43 100644 --- a/mesh_generators/MarchingCubesPro.cs +++ b/mesh_generators/MarchingCubesPro.cs @@ -9,7 +9,7 @@ namespace gs { - public class MarchingCubesPro + [Serializable] public class MarchingCubesPro { /// /// this is the function we will evaluate @@ -40,7 +40,7 @@ public class MarchingCubesPro /// public bool ParallelCompute = true; - public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } + [Serializable] public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } /// /// Which rootfinding method will be used to converge on surface along edges diff --git a/mesh_generators/PlaneGenerators.cs b/mesh_generators/PlaneGenerators.cs index fa547dbe..645491af 100644 --- a/mesh_generators/PlaneGenerators.cs +++ b/mesh_generators/PlaneGenerators.cs @@ -7,7 +7,7 @@ namespace g3 { // generate a two-triangle rect, centered at origin - public class TrivialRectGenerator : MeshGenerator + [Serializable] public class TrivialRectGenerator : MeshGenerator { public float Width = 1.0f; public float Height = 1.0f; @@ -20,7 +20,7 @@ public class TrivialRectGenerator : MeshGenerator /// public Index2i IndicesMap = new Index2i(1, 3); - public enum UVModes + [Serializable] public enum UVModes { FullUVSquare, CenteredUVRectangle, @@ -102,7 +102,7 @@ override public MeshGenerator Generate() /// with EdgeVertices verts along each edge. /// [TODO] allow varying EdgeVertices in each dimension (tricky...) /// - public class GriddedRectGenerator : TrivialRectGenerator + [Serializable] public class GriddedRectGenerator : TrivialRectGenerator { public int EdgeVertices = 8; @@ -197,7 +197,7 @@ override public MeshGenerator Generate() // Generate a rounded rect centered at origin. // Force individual corners to be sharp using the SharpCorners flags field. - public class RoundRectGenerator : MeshGenerator + [Serializable] public class RoundRectGenerator : MeshGenerator { public float Width = 1.0f; public float Height = 1.0f; @@ -206,7 +206,7 @@ public class RoundRectGenerator : MeshGenerator [Flags] - public enum Corner + [Serializable] public enum Corner { BottomLeft = 1, BottomRight = 2, @@ -216,7 +216,7 @@ public enum Corner public Corner SharpCorners = 0; - public enum UVModes + [Serializable] public enum UVModes { FullUVSquare, CenteredUVRectangle, diff --git a/mesh_generators/PointsMeshGenerators.cs b/mesh_generators/PointsMeshGenerators.cs index 5ef34ea3..1c98d51e 100644 --- a/mesh_generators/PointsMeshGenerators.cs +++ b/mesh_generators/PointsMeshGenerators.cs @@ -8,7 +8,7 @@ namespace g3 /// Create a mesh that contains a planar element for each point and normal /// (currently only triangles) /// - public class PointSplatsGenerator : MeshGenerator + [Serializable] public class PointSplatsGenerator : MeshGenerator { public IEnumerable PointIndices; public int PointIndicesCount = -1; // you can set this to avoid calling Count() on enumerable diff --git a/mesh_generators/RevolveGenerator.cs b/mesh_generators/RevolveGenerator.cs index d0f2f421..b36cf115 100644 --- a/mesh_generators/RevolveGenerator.cs +++ b/mesh_generators/RevolveGenerator.cs @@ -5,7 +5,7 @@ namespace g3 { - public class Curve3Axis3RevolveGenerator : MeshGenerator + [Serializable] public class Curve3Axis3RevolveGenerator : MeshGenerator { public Vector3d[] Curve; @@ -160,7 +160,7 @@ public override MeshGenerator Generate() - public class Curve3Curve3RevolveGenerator : MeshGenerator + [Serializable] public class Curve3Curve3RevolveGenerator : MeshGenerator { public Vector3d[] Curve; public Vector3d[] Axis; diff --git a/mesh_generators/SphereGenerators.cs b/mesh_generators/SphereGenerators.cs index 0b9e2977..7907616f 100644 --- a/mesh_generators/SphereGenerators.cs +++ b/mesh_generators/SphereGenerators.cs @@ -10,11 +10,11 @@ namespace g3 /// Generate a mesh of a sphere by first generating a mesh of a cube, /// and then normalizing the vertices and moving them to sphere of desired radius. /// - public class Sphere3Generator_NormalizedCube : GridBox3Generator + [Serializable] public class Sphere3Generator_NormalizedCube : GridBox3Generator { public double Radius = 1.0; - public enum NormalizationTypes + [Serializable] public enum NormalizationTypes { NormalizedVector, CubeMapping // produces more even distribution of quads diff --git a/mesh_generators/TriangulatedPolygonGenerator.cs b/mesh_generators/TriangulatedPolygonGenerator.cs index d09102a8..78b1313d 100644 --- a/mesh_generators/TriangulatedPolygonGenerator.cs +++ b/mesh_generators/TriangulatedPolygonGenerator.cs @@ -6,7 +6,7 @@ namespace g3 /// Triangulate a 2D polygon-with-holes by inserting it's edges into a meshed rectangle /// and then removing the triangles outside the polygon. /// - public class TriangulatedPolygonGenerator : MeshGenerator + [Serializable] public class TriangulatedPolygonGenerator : MeshGenerator { public GeneralPolygon2d Polygon; public Vector3f FixedNormal = Vector3f.AxisZ; diff --git a/mesh_generators/VoxelSurfaceGenerator.cs b/mesh_generators/VoxelSurfaceGenerator.cs index 7967d1dd..0c084930 100644 --- a/mesh_generators/VoxelSurfaceGenerator.cs +++ b/mesh_generators/VoxelSurfaceGenerator.cs @@ -5,7 +5,7 @@ namespace g3 { - public class VoxelSurfaceGenerator + [Serializable] public class VoxelSurfaceGenerator { public IBinaryVoxelGrid Voxels; diff --git a/mesh_ops/AutoHoleFill.cs b/mesh_ops/AutoHoleFill.cs index 7dfb8e5a..410f69e1 100644 --- a/mesh_ops/AutoHoleFill.cs +++ b/mesh_ops/AutoHoleFill.cs @@ -16,7 +16,7 @@ namespace gs /// then uses PlanarSpansFiller. See comments, is not really functional. /// /// - public class AutoHoleFill + [Serializable] public class AutoHoleFill { public DMesh3 Mesh; diff --git a/mesh_ops/LaplacianMeshDeformer.cs b/mesh_ops/LaplacianMeshDeformer.cs index 132a7dcd..5d8c52a3 100644 --- a/mesh_ops/LaplacianMeshDeformer.cs +++ b/mesh_ops/LaplacianMeshDeformer.cs @@ -4,7 +4,7 @@ namespace g3 { - public class LaplacianMeshDeformer + [Serializable] public class LaplacianMeshDeformer { public DMesh3 Mesh; @@ -17,7 +17,7 @@ public class LaplacianMeshDeformer double[] MLx, MLy, MLz; // constraints - public struct SoftConstraintV + [Serializable] public struct SoftConstraintV { public Vector3d Position; public double Weight; diff --git a/mesh_ops/LaplacianMeshSmoother.cs b/mesh_ops/LaplacianMeshSmoother.cs index 0ef409d6..cec876de 100644 --- a/mesh_ops/LaplacianMeshSmoother.cs +++ b/mesh_ops/LaplacianMeshSmoother.cs @@ -4,7 +4,7 @@ namespace g3 { - public class LaplacianMeshSmoother + [Serializable] public class LaplacianMeshSmoother { public DMesh3 Mesh; @@ -17,7 +17,7 @@ public class LaplacianMeshSmoother double[] MLx, MLy, MLz; // constraints - public struct SoftConstraintV + [Serializable] public struct SoftConstraintV { public Vector3d Position; public double Weight; diff --git a/mesh_ops/MergeCoincidentEdges.cs b/mesh_ops/MergeCoincidentEdges.cs index 1d1237cd..cec6df23 100644 --- a/mesh_ops/MergeCoincidentEdges.cs +++ b/mesh_ops/MergeCoincidentEdges.cs @@ -9,7 +9,7 @@ namespace gs /// /// Merge coincident edges. /// - public class MergeCoincidentEdges + [Serializable] public class MergeCoincidentEdges { public DMesh3 Mesh; diff --git a/mesh_ops/MeshAssembly.cs b/mesh_ops/MeshAssembly.cs index b290b3cd..d395eb0f 100644 --- a/mesh_ops/MeshAssembly.cs +++ b/mesh_ops/MeshAssembly.cs @@ -14,7 +14,7 @@ namespace gs /// Given an input mesh, try to decompose it's connected components into /// parts with some semantics - solids, open meshes, etc. /// - public class MeshAssembly + [Serializable] public class MeshAssembly { public DMesh3 SourceMesh; diff --git a/mesh_ops/MeshAutoRepair.cs b/mesh_ops/MeshAutoRepair.cs index bc529466..de44d709 100644 --- a/mesh_ops/MeshAutoRepair.cs +++ b/mesh_ops/MeshAutoRepair.cs @@ -16,7 +16,7 @@ namespace gs /// - this is tricky, in many CAD meshes these faces can't just be collapsed. But can often remove via flipping...? /// /// - public class MeshAutoRepair + [Serializable] public class MeshAutoRepair { public double RepairTolerance = MathUtil.ZeroTolerancef; @@ -28,7 +28,7 @@ public class MeshAutoRepair // [TODO] interior components? - public enum RemoveModes { + [Serializable] public enum RemoveModes { None = 0, Interior = 1, Occluded = 2 }; public RemoveModes RemoveMode = MeshAutoRepair.RemoveModes.None; diff --git a/mesh_ops/MeshBoolean.cs b/mesh_ops/MeshBoolean.cs index 6519bb19..b0e0c6bd 100644 --- a/mesh_ops/MeshBoolean.cs +++ b/mesh_ops/MeshBoolean.cs @@ -8,7 +8,7 @@ namespace g3 { - public class MeshBoolean + [Serializable] public class MeshBoolean { public DMesh3 Target; public DMesh3 Tool; diff --git a/mesh_ops/MeshExtrudeFaces.cs b/mesh_ops/MeshExtrudeFaces.cs index 13ec1a95..5bbdac0f 100644 --- a/mesh_ops/MeshExtrudeFaces.cs +++ b/mesh_ops/MeshExtrudeFaces.cs @@ -16,7 +16,7 @@ namespace g3 /// and then connected w/ strip /// [TODO] implement this behavior /// - public class MeshExtrudeFaces + [Serializable] public class MeshExtrudeFaces { public DMesh3 Mesh; public int[] Triangles; diff --git a/mesh_ops/MeshExtrudeLoop.cs b/mesh_ops/MeshExtrudeLoop.cs index a66d2907..c8a421a8 100644 --- a/mesh_ops/MeshExtrudeLoop.cs +++ b/mesh_ops/MeshExtrudeLoop.cs @@ -8,7 +8,7 @@ namespace g3 /// Operation makes a duplicate loop of vertices, at location defind by PositionF, /// then stitches input and new loops together with a ring of triangles. /// - public class MeshExtrudeLoop + [Serializable] public class MeshExtrudeLoop { public DMesh3 Mesh; public EdgeLoop Loop; diff --git a/mesh_ops/MeshExtrudeMesh.cs b/mesh_ops/MeshExtrudeMesh.cs index bc4e878d..cb1f1329 100644 --- a/mesh_ops/MeshExtrudeMesh.cs +++ b/mesh_ops/MeshExtrudeMesh.cs @@ -10,7 +10,7 @@ namespace g3 /// 2) offset copy vertices /// 3) connect up loops with triangle strips /// - public class MeshExtrudeMesh + [Serializable] public class MeshExtrudeMesh { public DMesh3 Mesh; diff --git a/mesh_ops/MeshICP.cs b/mesh_ops/MeshICP.cs index bd9784c8..9164c034 100644 --- a/mesh_ops/MeshICP.cs +++ b/mesh_ops/MeshICP.cs @@ -4,7 +4,7 @@ namespace g3 { - public class MeshICP + [Serializable] public class MeshICP { public IPointSet Source; public DMeshAABBTree3 TargetSurface; diff --git a/mesh_ops/MeshInsertPolygon.cs b/mesh_ops/MeshInsertPolygon.cs index 65830167..cf116e8a 100644 --- a/mesh_ops/MeshInsertPolygon.cs +++ b/mesh_ops/MeshInsertPolygon.cs @@ -9,7 +9,7 @@ namespace g3 /// Inserted edge set is avaliable as .InsertedPolygonEdges, and /// triangles inside polygon as .InteriorTriangles /// - public class MeshInsertPolygon + [Serializable] public class MeshInsertPolygon { public DMesh3 Mesh; public GeneralPolygon2d Polygon; diff --git a/mesh_ops/MeshInsertProjectedPolygon.cs b/mesh_ops/MeshInsertProjectedPolygon.cs index 5b834ae7..8b032a30 100644 --- a/mesh_ops/MeshInsertProjectedPolygon.cs +++ b/mesh_ops/MeshInsertProjectedPolygon.cs @@ -48,7 +48,7 @@ namespace gs /// bary-coords, so that we can compute the new 3D positions. /// /// - public class MeshInsertProjectedPolygon + [Serializable] public class MeshInsertProjectedPolygon { public DMesh3 Mesh; public int SeedTriangle = -1; // you must provide this so that we can efficiently diff --git a/mesh_ops/MeshInsertUVPolyCurve.cs b/mesh_ops/MeshInsertUVPolyCurve.cs index 68676e19..0504f372 100644 --- a/mesh_ops/MeshInsertUVPolyCurve.cs +++ b/mesh_ops/MeshInsertUVPolyCurve.cs @@ -19,7 +19,7 @@ namespace g3 /// preprocess the input mesh to remove degenerate faces/edges /// /// - public class MeshInsertUVPolyCurve + [Serializable] public class MeshInsertUVPolyCurve { public DMesh3 Mesh; public PolyLine2d Curve; diff --git a/mesh_ops/MeshIsoCurves.cs b/mesh_ops/MeshIsoCurves.cs index 6169ba32..3b14d979 100644 --- a/mesh_ops/MeshIsoCurves.cs +++ b/mesh_ops/MeshIsoCurves.cs @@ -5,7 +5,7 @@ namespace g3 { - public class MeshIsoCurves + [Serializable] public class MeshIsoCurves { public DMesh3 Mesh; public Func ValueF = null; @@ -22,7 +22,7 @@ public class MeshIsoCurves public bool PrecomputeVertexValues = false; - public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } + [Serializable] public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } /// /// Which rootfinding method will be used to converge on surface along edges @@ -37,7 +37,7 @@ public enum RootfindingModes { SingleLerp, LerpSteps, Bisection } public DGraph3 Graph = null; - public enum TriangleCase + [Serializable] public enum TriangleCase { EdgeEdge = 1, EdgeVertex = 2, @@ -51,7 +51,7 @@ public enum TriangleCase /// mesh_tri is triangle ID of crossed triangle /// mesh_edges depends on case. EdgeEdge is [edgeid,edgeid], EdgeVertex is [edgeid,vertexid], and OnEdge is [edgeid,-1] /// - public struct GraphEdgeInfo + [Serializable] public struct GraphEdgeInfo { public TriangleCase caseType; public int mesh_tri; diff --git a/mesh_ops/MeshIterativeSmooth.cs b/mesh_ops/MeshIterativeSmooth.cs index 99d8c2ea..31b9a96e 100644 --- a/mesh_ops/MeshIterativeSmooth.cs +++ b/mesh_ops/MeshIterativeSmooth.cs @@ -3,7 +3,7 @@ namespace g3 { - public class MeshIterativeSmooth + [Serializable] public class MeshIterativeSmooth { public DMesh3 Mesh; public int[] Vertices; diff --git a/mesh_ops/MeshLocalParam.cs b/mesh_ops/MeshLocalParam.cs index d631a487..ca1f3f01 100644 --- a/mesh_ops/MeshLocalParam.cs +++ b/mesh_ops/MeshLocalParam.cs @@ -6,12 +6,12 @@ namespace g3 { - public class MeshLocalParam + [Serializable] public class MeshLocalParam { public static readonly Vector2f InvalidUV = new Vector2f(float.MaxValue, float.MaxValue); - public enum UVModes + [Serializable] public enum UVModes { ExponentialMap, ExponentialMap_UpwindAvg, diff --git a/mesh_ops/MeshLoopClosure.cs b/mesh_ops/MeshLoopClosure.cs index 90e6044b..dc1ad5ed 100644 --- a/mesh_ops/MeshLoopClosure.cs +++ b/mesh_ops/MeshLoopClosure.cs @@ -4,7 +4,7 @@ namespace g3 { - public class MeshLoopClosure + [Serializable] public class MeshLoopClosure { public DMesh3 Mesh; public EdgeLoop InitialBorderLoop; diff --git a/mesh_ops/MeshLoopSmooth.cs b/mesh_ops/MeshLoopSmooth.cs index 1761b479..2f1929f7 100644 --- a/mesh_ops/MeshLoopSmooth.cs +++ b/mesh_ops/MeshLoopSmooth.cs @@ -3,7 +3,7 @@ namespace g3 { - public class MeshLoopSmooth + [Serializable] public class MeshLoopSmooth { public DMesh3 Mesh; public EdgeLoop Loop; diff --git a/mesh_ops/MeshMeshCut.cs b/mesh_ops/MeshMeshCut.cs index f00a0035..51e9acad 100644 --- a/mesh_ops/MeshMeshCut.cs +++ b/mesh_ops/MeshMeshCut.cs @@ -17,7 +17,7 @@ namespace g3 /// /// /// - public class MeshMeshCut + [Serializable] public class MeshMeshCut { public DMesh3 Target; public DMesh3 CutMesh; diff --git a/mesh_ops/MeshOps.cs b/mesh_ops/MeshOps.cs index b750b102..e0600a2a 100644 --- a/mesh_ops/MeshOps.cs +++ b/mesh_ops/MeshOps.cs @@ -3,9 +3,9 @@ namespace g3 { - public struct SetGroupBehavior + [Serializable] public struct SetGroupBehavior { - public enum Modes + [Serializable] public enum Modes { Ignore = 0, AutoGenerate = 1, diff --git a/mesh_ops/MeshPlaneCut.cs b/mesh_ops/MeshPlaneCut.cs index 7ecc011f..a77eb1de 100644 --- a/mesh_ops/MeshPlaneCut.cs +++ b/mesh_ops/MeshPlaneCut.cs @@ -23,7 +23,7 @@ namespace g3 /// boundary edge tracking... /// /// - public class MeshPlaneCut + [Serializable] public class MeshPlaneCut { // Inputs public DMesh3 Mesh; diff --git a/mesh_ops/MeshRepairOrientation.cs b/mesh_ops/MeshRepairOrientation.cs index 6b4a7ad5..25c61ed4 100644 --- a/mesh_ops/MeshRepairOrientation.cs +++ b/mesh_ops/MeshRepairOrientation.cs @@ -8,7 +8,7 @@ namespace gs { - public class MeshRepairOrientation + [Serializable] public class MeshRepairOrientation { public DMesh3 Mesh; diff --git a/mesh_ops/MeshSpatialSort.cs b/mesh_ops/MeshSpatialSort.cs index b2f74a12..6fc6cfc4 100644 --- a/mesh_ops/MeshSpatialSort.cs +++ b/mesh_ops/MeshSpatialSort.cs @@ -10,7 +10,7 @@ namespace gs /// /// This class sorts a set of mesh components. /// - public class MeshSpatialSort + [Serializable] public class MeshSpatialSort { // ComponentMesh is a wrapper around input meshes public List Components; @@ -43,7 +43,7 @@ public void AddMesh(DMesh3 mesh, object identifier, DMeshAABBTree3 spatial = nul - public class ComponentMesh + [Serializable] public class ComponentMesh { public object Identifier; public DMesh3 Mesh; @@ -94,7 +94,7 @@ public bool Contains(ComponentMesh mesh2, double fIso = 0.5f) - public class MeshSolid + [Serializable] public class MeshSolid { public ComponentMesh Outer; public List Cavities = new List(); diff --git a/mesh_ops/MeshStitchLoops.cs b/mesh_ops/MeshStitchLoops.cs index 3cde53f8..011813aa 100644 --- a/mesh_ops/MeshStitchLoops.cs +++ b/mesh_ops/MeshStitchLoops.cs @@ -19,7 +19,7 @@ namespace gs /// stitching "through" mesh or not. If not set properly, then fill self-intersects. /// Could we (optionally) resolve this automatically, eg by checking total of the two alternatives? /// - public class MeshStitchLoops + [Serializable] public class MeshStitchLoops { public DMesh3 Mesh; public EdgeLoop Loop0; diff --git a/mesh_ops/MeshTopology.cs b/mesh_ops/MeshTopology.cs index fc5512c5..81a273db 100644 --- a/mesh_ops/MeshTopology.cs +++ b/mesh_ops/MeshTopology.cs @@ -16,7 +16,7 @@ namespace gs /// WIP /// /// - public class MeshTopology + [Serializable] public class MeshTopology { public DMesh3 Mesh; diff --git a/mesh_ops/MeshTrimLoop.cs b/mesh_ops/MeshTrimLoop.cs index 70cbddaf..14168347 100644 --- a/mesh_ops/MeshTrimLoop.cs +++ b/mesh_ops/MeshTrimLoop.cs @@ -25,7 +25,7 @@ namespace g3 /// - output boundary EdgeLoop that has been aligned w/ trim curve /// - handle cases where input mesh has open borders /// - public class MeshTrimLoop + [Serializable] public class MeshTrimLoop { public DMesh3 Mesh; public DMeshAABBTree3 Spatial; diff --git a/mesh_ops/MinimalHoleFill.cs b/mesh_ops/MinimalHoleFill.cs index 703901f1..870162ed 100644 --- a/mesh_ops/MinimalHoleFill.cs +++ b/mesh_ops/MinimalHoleFill.cs @@ -13,7 +13,7 @@ namespace gs /// is often quasi-developable, reconstructs sharp edges, etc. /// There are various options. /// - public class MinimalHoleFill + [Serializable] public class MinimalHoleFill { public DMesh3 Mesh; public EdgeLoop FillLoop; diff --git a/mesh_ops/PlanarHoleFiller.cs b/mesh_ops/PlanarHoleFiller.cs index ad4daaf8..c703c5fb 100644 --- a/mesh_ops/PlanarHoleFiller.cs +++ b/mesh_ops/PlanarHoleFiller.cs @@ -23,7 +23,7 @@ namespace g3 /// not be stitched. /// /// - public class PlanarHoleFiller + [Serializable] public class PlanarHoleFiller { public DMesh3 Mesh; diff --git a/mesh_ops/PlanarSpansFiller.cs b/mesh_ops/PlanarSpansFiller.cs index 245e7cf5..aeb6de00 100644 --- a/mesh_ops/PlanarSpansFiller.cs +++ b/mesh_ops/PlanarSpansFiller.cs @@ -20,7 +20,7 @@ namespace g3 /// /// /// - public class PlanarSpansFiller + [Serializable] public class PlanarSpansFiller { public DMesh3 Mesh; diff --git a/mesh_ops/RegionOperator.cs b/mesh_ops/RegionOperator.cs index b90f3737..1309dfed 100644 --- a/mesh_ops/RegionOperator.cs +++ b/mesh_ops/RegionOperator.cs @@ -14,7 +14,7 @@ namespace g3 /// trying to guess it here, by making some assumptions about what happens. It works for now, but /// it would better if MeshEditor returned this information. /// - public class RegionOperator + [Serializable] public class RegionOperator { public DMesh3 BaseMesh; public DSubmesh3 Region; diff --git a/mesh_ops/RemoveDuplicateTriangles.cs b/mesh_ops/RemoveDuplicateTriangles.cs index d06b3453..d86b45e4 100644 --- a/mesh_ops/RemoveDuplicateTriangles.cs +++ b/mesh_ops/RemoveDuplicateTriangles.cs @@ -9,7 +9,7 @@ namespace gs /// /// Remove duplicate triangles. /// - public class RemoveDuplicateTriangles + [Serializable] public class RemoveDuplicateTriangles { public DMesh3 Mesh; diff --git a/mesh_ops/RemoveOccludedTriangles.cs b/mesh_ops/RemoveOccludedTriangles.cs index 06936376..be4c2c7e 100644 --- a/mesh_ops/RemoveOccludedTriangles.cs +++ b/mesh_ops/RemoveOccludedTriangles.cs @@ -14,7 +14,7 @@ namespace gs /// something akin to ambient occlusion, and if face is fully occluded, then /// we classify it as inside and remove it. /// - public class RemoveOccludedTriangles + [Serializable] public class RemoveOccludedTriangles { public DMesh3 Mesh; public DMeshAABBTree3 Spatial; @@ -35,7 +35,7 @@ public class RemoveOccludedTriangles // use this as winding isovalue for WindingNumber mode public double WindingIsoValue = 0.5; - public enum CalculationMode + [Serializable] public enum CalculationMode { RayParity = 0, AnalyticWindingNumber = 1, diff --git a/mesh_ops/SimpleHoleFiller.cs b/mesh_ops/SimpleHoleFiller.cs index 1b0e072f..14ee9cda 100644 --- a/mesh_ops/SimpleHoleFiller.cs +++ b/mesh_ops/SimpleHoleFiller.cs @@ -5,7 +5,7 @@ namespace g3 { - public class SimpleHoleFiller + [Serializable] public class SimpleHoleFiller { public DMesh3 Mesh; public EdgeLoop Loop; diff --git a/mesh_ops/SmoothedHoleFill.cs b/mesh_ops/SmoothedHoleFill.cs index 65d50d1c..4e68a6cf 100644 --- a/mesh_ops/SmoothedHoleFill.cs +++ b/mesh_ops/SmoothedHoleFill.cs @@ -12,7 +12,7 @@ namespace gs /// This fills a hole in a mesh by doing a trivial fill, optionally offsetting along a fixed vector, /// then doing a remesh, then a laplacian smooth, then a second remesh. /// - public class SmoothedHoleFill + [Serializable] public class SmoothedHoleFill { public DMesh3 Mesh; diff --git a/mesh_selection/MeshBoundaryLoops.cs b/mesh_selection/MeshBoundaryLoops.cs index 8b256483..c5a88f09 100644 --- a/mesh_selection/MeshBoundaryLoops.cs +++ b/mesh_selection/MeshBoundaryLoops.cs @@ -6,7 +6,7 @@ namespace g3 { - public class MeshBoundaryLoopsException : Exception + [Serializable] public class MeshBoundaryLoopsException : Exception { public MeshBoundaryLoopsException(string message) : base(message) {} public bool UnclosedLoop = false; @@ -18,7 +18,7 @@ public MeshBoundaryLoopsException(string message) : base(message) {} /// Extract boundary EdgeLoops from Mesh. Can also extract EdgeSpans for open areas, /// however default behavior is to ignore these. Set .SpanBehavior to configure. /// - public class MeshBoundaryLoops : IEnumerable + [Serializable] public class MeshBoundaryLoops : IEnumerable { public DMesh3 Mesh; public List Loops; @@ -30,14 +30,14 @@ public class MeshBoundaryLoops : IEnumerable // What should we do if we encounter open spans. Mainly a result of EdgeFilter, but can also // happen on meshes w/ crazy bowties - public enum SpanBehaviors + [Serializable] public enum SpanBehaviors { Ignore, ThrowException, Compute }; public SpanBehaviors SpanBehavior = SpanBehaviors.Compute; // What should we do if we encounter an unrecoverable failure while walking a loop - public enum FailureBehaviors + [Serializable] public enum FailureBehaviors { ThrowException, // die, and you clean up ConvertToOpenSpan // keep un-closed loop as a span diff --git a/mesh_selection/MeshConnectedComponents.cs b/mesh_selection/MeshConnectedComponents.cs index 2c71559a..0cf64d24 100644 --- a/mesh_selection/MeshConnectedComponents.cs +++ b/mesh_selection/MeshConnectedComponents.cs @@ -4,7 +4,7 @@ namespace g3 { - public class MeshConnectedComponents : IEnumerable + [Serializable] public class MeshConnectedComponents : IEnumerable { public DMesh3 Mesh; @@ -18,7 +18,7 @@ public class MeshConnectedComponents : IEnumerable SeedFilterF = null; - public struct Component + [Serializable] public struct Component { public int[] Indices; } diff --git a/mesh_selection/MeshEdgeSelection.cs b/mesh_selection/MeshEdgeSelection.cs index 958826e9..2b022ffa 100644 --- a/mesh_selection/MeshEdgeSelection.cs +++ b/mesh_selection/MeshEdgeSelection.cs @@ -7,7 +7,7 @@ namespace g3 { - public class MeshEdgeSelection : IEnumerable + [Serializable] public class MeshEdgeSelection : IEnumerable { public DMesh3 Mesh; diff --git a/mesh_selection/MeshFaceSelection.cs b/mesh_selection/MeshFaceSelection.cs index e9540801..373e1e1e 100644 --- a/mesh_selection/MeshFaceSelection.cs +++ b/mesh_selection/MeshFaceSelection.cs @@ -7,7 +7,7 @@ namespace g3 { - public class MeshFaceSelection : IEnumerable + [Serializable] public class MeshFaceSelection : IEnumerable { public DMesh3 Mesh; diff --git a/mesh_selection/MeshFacesFromLoop.cs b/mesh_selection/MeshFacesFromLoop.cs index 98192d68..80452e44 100644 --- a/mesh_selection/MeshFacesFromLoop.cs +++ b/mesh_selection/MeshFacesFromLoop.cs @@ -10,7 +10,7 @@ namespace g3 /// If a seed triangle in the enclosed region is not provided, then the /// smaller of the two largest connected-components is chosen as the "inside". /// - public class MeshFacesFromLoop + [Serializable] public class MeshFacesFromLoop { public DMesh3 Mesh; diff --git a/mesh_selection/MeshRegionBoundaryLoops.cs b/mesh_selection/MeshRegionBoundaryLoops.cs index 806f62a7..539a6a6b 100644 --- a/mesh_selection/MeshRegionBoundaryLoops.cs +++ b/mesh_selection/MeshRegionBoundaryLoops.cs @@ -11,7 +11,7 @@ namespace g3 /// /// Extract boundary EdgeLoops for subregions of Mesh /// - public class MeshRegionBoundaryLoops : IEnumerable + [Serializable] public class MeshRegionBoundaryLoops : IEnumerable { public DMesh3 Mesh; public List Loops; diff --git a/mesh_selection/MeshVertexSelection.cs b/mesh_selection/MeshVertexSelection.cs index cda76921..c5301cc3 100644 --- a/mesh_selection/MeshVertexSelection.cs +++ b/mesh_selection/MeshVertexSelection.cs @@ -7,7 +7,7 @@ namespace g3 { - public class MeshVertexSelection : IEnumerable + [Serializable] public class MeshVertexSelection : IEnumerable { public DMesh3 Mesh; diff --git a/queries/IntersectionUtil.cs b/queries/IntersectionUtil.cs index b0e1fcc0..5ac2ff99 100644 --- a/queries/IntersectionUtil.cs +++ b/queries/IntersectionUtil.cs @@ -5,7 +5,7 @@ namespace g3 { - public enum IntersectionResult + [Serializable] public enum IntersectionResult { NotComputed, Intersects, @@ -13,7 +13,7 @@ public enum IntersectionResult InvalidQuery } - public enum IntersectionType + [Serializable] public enum IntersectionType { Empty, Point, Segment, Line, Polygon, Plane, Unknown } @@ -21,7 +21,7 @@ public enum IntersectionType /// /// returned by linear-primitive intersection functions /// - public struct LinearIntersection + [Serializable] public struct LinearIntersection { public bool intersects; public int numIntersections; // 0, 1, or 2 diff --git a/queries/MeshValidation.cs b/queries/MeshValidation.cs index 99c0be49..721f4b9a 100644 --- a/queries/MeshValidation.cs +++ b/queries/MeshValidation.cs @@ -4,7 +4,7 @@ namespace g3 { - public enum ValidationStatus + [Serializable] public enum ValidationStatus { Ok, diff --git a/queries/RayIntersection.cs b/queries/RayIntersection.cs index 1c60a980..352bf66a 100644 --- a/queries/RayIntersection.cs +++ b/queries/RayIntersection.cs @@ -5,7 +5,7 @@ namespace g3 { - public class RayIntersection + [Serializable] public class RayIntersection { private RayIntersection() { diff --git a/shapes3/Circle3.cs b/shapes3/Circle3.cs index 07a80241..098cb3db 100644 --- a/shapes3/Circle3.cs +++ b/shapes3/Circle3.cs @@ -3,7 +3,7 @@ namespace g3 { // somewhat ported from WildMagic5 - public class Circle3d + [Serializable] public class Circle3d { // The plane containing the circle is Dot(N,X-C) = 0, where X is any point // in the plane. Vectors U, V, and N form an orthonormal right-handed set diff --git a/shapes3/Cylinder3.cs b/shapes3/Cylinder3.cs index 9d0df28c..3592ff45 100644 --- a/shapes3/Cylinder3.cs +++ b/shapes3/Cylinder3.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from GTEngine (WildMagic5 doesn't have cylinder primitive) - public class Cylinder3d + [Serializable] public class Cylinder3d { // The cylinder axis is a line. The origin of the cylinder is chosen to be // the line origin. The cylinder wall is at a distance R units from the axis. diff --git a/solvers/CholeskyDecomposition.cs b/solvers/CholeskyDecomposition.cs index 8cbba66f..9681e588 100644 --- a/solvers/CholeskyDecomposition.cs +++ b/solvers/CholeskyDecomposition.cs @@ -14,7 +14,7 @@ namespace g3 /// /// /// - public class CholeskyDecomposition + [Serializable] public class CholeskyDecomposition { public DenseMatrix A; diff --git a/solvers/DenseMatrix.cs b/solvers/DenseMatrix.cs index 58ff0c23..94d2b414 100644 --- a/solvers/DenseMatrix.cs +++ b/solvers/DenseMatrix.cs @@ -6,7 +6,7 @@ namespace g3 /// /// Row-major dense matrix /// - public class DenseMatrix : IMatrix + [Serializable] public class DenseMatrix : IMatrix { double[] d; int N; // rows diff --git a/solvers/DenseVector.cs b/solvers/DenseVector.cs index 3feda736..729500f8 100644 --- a/solvers/DenseVector.cs +++ b/solvers/DenseVector.cs @@ -2,7 +2,7 @@ namespace g3 { - public class DenseVector + [Serializable] public class DenseVector { double[] d; int N; diff --git a/solvers/FastQuaternionSVD.cs b/solvers/FastQuaternionSVD.cs index d3aa75e1..024def73 100644 --- a/solvers/FastQuaternionSVD.cs +++ b/solvers/FastQuaternionSVD.cs @@ -28,7 +28,7 @@ namespace g3 /// - SymmetricMatrix3d currently a class, could make a struct (see comments) /// /// - public class FastQuaternionSVD + [Serializable] public class FastQuaternionSVD { int NumJacobiIterations = 4; // increase this to get higher accuracy // TODO: characterize... diff --git a/solvers/PackedSparseMatrix.cs b/solvers/PackedSparseMatrix.cs index 7f2f2c96..1772af6f 100644 --- a/solvers/PackedSparseMatrix.cs +++ b/solvers/PackedSparseMatrix.cs @@ -5,7 +5,7 @@ namespace g3 { - public struct matrix_entry + [Serializable] public struct matrix_entry { public int r; public int c; @@ -18,9 +18,9 @@ public struct matrix_entry /// This is a sparse matrix where each row is an array of (column,value) pairs /// This is more efficient for Matrix*Vector multiply. /// - public class PackedSparseMatrix + [Serializable] public class PackedSparseMatrix { - public struct nonzero + [Serializable] public struct nonzero { public int j; public double d; @@ -31,7 +31,7 @@ public struct nonzero public bool Sorted = false; public int NumNonZeros = 0; - public enum StorageModes + [Serializable] public enum StorageModes { Full } diff --git a/solvers/SingularValueDecomposition.cs b/solvers/SingularValueDecomposition.cs index b206b33d..dc2d04df 100644 --- a/solvers/SingularValueDecomposition.cs +++ b/solvers/SingularValueDecomposition.cs @@ -20,7 +20,7 @@ namespace g3 /// if ( det(V) == -1 ) { V *= -1; S *= -1 } (right? seems to work) /// /// - public class SingularValueDecomposition + [Serializable] public class SingularValueDecomposition { // port of WildMagic5 SingularValueDecomposition class (which is a back-port // of GTEngine SVD class) see geometrictools.com diff --git a/solvers/SparseMatrix.cs b/solvers/SparseMatrix.cs index 5a308c86..1c0bfa5b 100644 --- a/solvers/SparseMatrix.cs +++ b/solvers/SparseMatrix.cs @@ -12,7 +12,7 @@ namespace g3 /// Uses Dictionary as sparsifying data structure, which is probably /// not a good option. But it is easy. /// - public class SymmetricSparseMatrix : IMatrix + [Serializable] public class SymmetricSparseMatrix : IMatrix { Dictionary d = new Dictionary(); int N; @@ -310,7 +310,7 @@ void get_row_nonzeros(int r, List buf) - public class DiagonalMatrix + [Serializable] public class DiagonalMatrix { public double[] D; diff --git a/solvers/SparseSymmetricCG.cs b/solvers/SparseSymmetricCG.cs index f492a0ae..573dc72d 100644 --- a/solvers/SparseSymmetricCG.cs +++ b/solvers/SparseSymmetricCG.cs @@ -3,7 +3,7 @@ namespace g3 { // ported from WildMagic5 Wm5LinearSystem.cpp - public class SparseSymmetricCG + [Serializable] public class SparseSymmetricCG { // Compute B = A*X, where inputs are ordered public Action MultiplyF; @@ -223,7 +223,7 @@ public bool SolvePreconditioned() /// converged, however we still have to do the multiplies! /// /// - public class SparseSymmetricCGMultipleRHS + [Serializable] public class SparseSymmetricCGMultipleRHS { // Compute B = A*X, where inputs are ordered public Action MultiplyF; diff --git a/solvers/SymmetricEigenSolver.cs b/solvers/SymmetricEigenSolver.cs index e17c39dd..827986ed 100644 --- a/solvers/SymmetricEigenSolver.cs +++ b/solvers/SymmetricEigenSolver.cs @@ -38,7 +38,7 @@ namespace g3 // vectors in the lower-triangular portion of the matrix to save memory. The // implementation uses both suggestions. - public class SymmetricEigenSolver + [Serializable] public class SymmetricEigenSolver { // The solver processes NxN symmetric matrices, where N > 1 ('size' is N) // and the matrix is stored in row-major order. The maximum number of @@ -70,7 +70,7 @@ public SymmetricEigenSolver(int size, int maxIterations) // ordered accordingly. The return value is the number of iterations // consumed when convergence occurred, 0xFFFFFFFF when convergence did // not occur, or 0 when N <= 1 was passed to the constructor. - public enum SortType + [Serializable] public enum SortType { Decreasing = -1, NoSorting = 0, diff --git a/spatial/BasicIntersectionTargets.cs b/spatial/BasicIntersectionTargets.cs index ed2ce78a..6017608e 100644 --- a/spatial/BasicIntersectionTargets.cs +++ b/spatial/BasicIntersectionTargets.cs @@ -6,7 +6,7 @@ namespace g3 { - public class TransformedIntersectionTarget : IIntersectionTarget + [Serializable] public class TransformedIntersectionTarget : IIntersectionTarget { DMeshIntersectionTarget BaseTarget = null; @@ -32,7 +32,7 @@ public bool RayIntersect(Ray3d ray, out Vector3d vHit, out Vector3d vHitNormal) - public class DMeshIntersectionTarget : IIntersectionTarget + [Serializable] public class DMeshIntersectionTarget : IIntersectionTarget { public DMesh3 Mesh { get; set; } public ISpatial Spatial { get; set; } @@ -69,7 +69,7 @@ public bool RayIntersect(Ray3d ray, out Vector3d vHit, out Vector3d vHitNormal) /// /// Compute ray-intersection with plane /// - public class PlaneIntersectionTarget : IIntersectionTarget + [Serializable] public class PlaneIntersectionTarget : IIntersectionTarget { public Frame3f PlaneFrame; public int NormalAxis = 2; diff --git a/spatial/BasicProjectionTargets.cs b/spatial/BasicProjectionTargets.cs index 6d274c5c..a72dd00f 100644 --- a/spatial/BasicProjectionTargets.cs +++ b/spatial/BasicProjectionTargets.cs @@ -9,7 +9,7 @@ namespace g3 /// MeshProjectionTarget provides an IProjectionTarget interface to a mesh + spatial data structure. /// Use to project points to mesh surface. /// - public class MeshProjectionTarget : IOrientedProjectionTarget + [Serializable] public class MeshProjectionTarget : IOrientedProjectionTarget { public DMesh3 Mesh { get; set; } public ISpatial Spatial { get; set; } @@ -82,7 +82,7 @@ public static MeshProjectionTarget Auto(DMesh3 mesh, IEnumerable triangles, /// Extension of MeshProjectionTarget that allows the target to have a transformation /// relative to it's internal space. Call SetTransform(), or initialize the transforms yourself /// - public class TransformedMeshProjectionTarget : MeshProjectionTarget + [Serializable] public class TransformedMeshProjectionTarget : MeshProjectionTarget { public TransformSequence SourceToTargetXForm; public TransformSequence TargetToSourceXForm; @@ -127,7 +127,7 @@ public override Vector3d Project(Vector3d vPoint, out Vector3d vProjectNormal, i - public class PlaneProjectionTarget : IProjectionTarget + [Serializable] public class PlaneProjectionTarget : IProjectionTarget { public Vector3d Origin; public Vector3d Normal; @@ -142,7 +142,7 @@ public Vector3d Project(Vector3d vPoint, int identifier = -1) - public class CircleProjectionTarget : IProjectionTarget + [Serializable] public class CircleProjectionTarget : IProjectionTarget { public Circle3d Circle; @@ -156,7 +156,7 @@ public Vector3d Project(Vector3d vPoint, int identifier = -1) - public class CylinderProjectionTarget : IProjectionTarget + [Serializable] public class CylinderProjectionTarget : IProjectionTarget { public Cylinder3d Cylinder; @@ -171,7 +171,7 @@ public Vector3d Project(Vector3d vPoint, int identifer = -1) - public class SequentialProjectionTarget : IProjectionTarget + [Serializable] public class SequentialProjectionTarget : IProjectionTarget { public IProjectionTarget[] Targets { get; set; } diff --git a/spatial/BiGrid3.cs b/spatial/BiGrid3.cs index b4545a13..e4730bfa 100644 --- a/spatial/BiGrid3.cs +++ b/spatial/BiGrid3.cs @@ -11,7 +11,7 @@ namespace g3 /// automatically generates necessary data structures. /// Functions to act on parent/child grids are in-progress... /// - public class BiGrid3 where BlockType : class, IGridElement3, IFixedGrid3 + [Serializable] public class BiGrid3 where BlockType : class, IGridElement3, IFixedGrid3 { Vector3i block_size; MultigridIndexer3 indexer; diff --git a/spatial/Bitmap2.cs b/spatial/Bitmap2.cs index e609c78b..679ddfa1 100644 --- a/spatial/Bitmap2.cs +++ b/spatial/Bitmap2.cs @@ -5,7 +5,7 @@ namespace g3 { - public class Bitmap2 + [Serializable] public class Bitmap2 { public BitArray Bits; diff --git a/spatial/Bitmap3.cs b/spatial/Bitmap3.cs index e0f86308..91540256 100644 --- a/spatial/Bitmap3.cs +++ b/spatial/Bitmap3.cs @@ -14,7 +14,7 @@ public interface IBinaryVoxelGrid - public class Bitmap3 : IBinaryVoxelGrid, IGridElement3, IFixedGrid3 + [Serializable] public class Bitmap3 : IBinaryVoxelGrid, IGridElement3, IFixedGrid3 { public BitArray Bits; diff --git a/spatial/DCurveBoxTree.cs b/spatial/DCurveBoxTree.cs index 0c231788..f362da77 100644 --- a/spatial/DCurveBoxTree.cs +++ b/spatial/DCurveBoxTree.cs @@ -14,7 +14,7 @@ namespace g3 /// [TODO] would it make more sense to have more than just 2 segments at lowest level? /// /// - public class DCurve3BoxTree + [Serializable] public class DCurve3BoxTree { public DCurve3 Curve; diff --git a/spatial/DCurveProjection.cs b/spatial/DCurveProjection.cs index 87b36d7a..39444d94 100644 --- a/spatial/DCurveProjection.cs +++ b/spatial/DCurveProjection.cs @@ -5,7 +5,7 @@ namespace g3 { - public class DCurveProjectionTarget : IProjectionTarget + [Serializable] public class DCurveProjectionTarget : IProjectionTarget { public DCurve3 Curve; diff --git a/spatial/DMeshAABBTree.cs b/spatial/DMeshAABBTree.cs index b28dcdef..5dc55473 100644 --- a/spatial/DMeshAABBTree.cs +++ b/spatial/DMeshAABBTree.cs @@ -29,7 +29,7 @@ namespace g3 /// - DoTraversal(generic_traversal_object) /// /// - public class DMeshAABBTree3 : ISpatial + [Serializable] public class DMeshAABBTree3 : ISpatial { protected DMesh3 mesh; protected int mesh_timestamp; @@ -63,7 +63,7 @@ public DMeshAABBTree3(DMesh3 m, bool autoBuild = false) // how should we build the tree? - public enum BuildStrategy + [Serializable] public enum BuildStrategy { Default, // currently TopDownMidpoint @@ -78,7 +78,7 @@ public enum BuildStrategy // 2-4x slower than TopDownMidpoint, but trees are generally more efficient and balanced. } - public enum ClusterPolicy + [Serializable] public enum ClusterPolicy { Default, // currently FastVolumeMetric Fastest, // sort list and then just cluster sequential boxes. @@ -651,17 +651,17 @@ protected bool find_any_intersection(int iBox, DMeshAABBTree3 otherTree, Func Points; public List Segments; @@ -1001,7 +1001,7 @@ public virtual bool IsInside(Vector3d p) /// that branch of the traversal, or true to descend into that box's children (boxes or triangles). /// NextTriangleF() is called for each triangle. /// - public class TreeTraversal + [Serializable] public class TreeTraversal { // return false to terminate this branch // arguments are box and depth in tree diff --git a/spatial/DSparseGrid3.cs b/spatial/DSparseGrid3.cs index 44b0ecd5..722347a5 100644 --- a/spatial/DSparseGrid3.cs +++ b/spatial/DSparseGrid3.cs @@ -45,7 +45,7 @@ public interface IGridElement3 /// This can be used to implement multi-grid schemes, eg for example the GridElement /// type could be Bitmap3 of a fixed dimension. /// - public class DSparseGrid3 : IGrid3 where ElemType : class, IGridElement3 + [Serializable] public class DSparseGrid3 : IGrid3 where ElemType : class, IGridElement3 { ElemType exemplar; diff --git a/spatial/DenseGrid2.cs b/spatial/DenseGrid2.cs index 84eefdc1..5bf25da7 100644 --- a/spatial/DenseGrid2.cs +++ b/spatial/DenseGrid2.cs @@ -10,7 +10,7 @@ namespace g3 /// /// 2D dense grid of floating-point scalar values. /// - public class DenseGrid2f + [Serializable] public class DenseGrid2f { public float[] Buffer; public int ni, nj; @@ -160,7 +160,7 @@ public IEnumerable InsetIndices(int border_width) /// /// 2D dense grid of integers. /// - public class DenseGrid2i + [Serializable] public class DenseGrid2i { public int[] Buffer; public int ni, nj; diff --git a/spatial/DenseGrid3.cs b/spatial/DenseGrid3.cs index 2b36404c..bc1c08cf 100644 --- a/spatial/DenseGrid3.cs +++ b/spatial/DenseGrid3.cs @@ -9,7 +9,7 @@ namespace g3 /// /// 3D dense grid of floating-point scalar values. /// - public class DenseGrid3f + [Serializable] public class DenseGrid3f { public float[] Buffer; public int ni, nj, nk; @@ -209,7 +209,7 @@ public int to_linear(Vector3i ijk) /// /// 3D dense grid of integers. /// - public class DenseGrid3i + [Serializable] public class DenseGrid3i { public int[] Buffer; public int ni, nj, nk; diff --git a/spatial/EditMeshSpatial.cs b/spatial/EditMeshSpatial.cs index 862c5b38..8102adca 100644 --- a/spatial/EditMeshSpatial.cs +++ b/spatial/EditMeshSpatial.cs @@ -13,7 +13,7 @@ namespace gs /// For use case where we are making local edits to a source mesh. We mask out /// removed triangles from base mesh SpatialDS, and raycast new triangles separately. /// - public class EditMeshSpatial : ISpatial + [Serializable] public class EditMeshSpatial : ISpatial { public DMesh3 SourceMesh; public DMeshAABBTree3 SourceSpatial; diff --git a/spatial/GridIndexing.cs b/spatial/GridIndexing.cs index b6e53b64..c0c9642f 100644 --- a/spatial/GridIndexing.cs +++ b/spatial/GridIndexing.cs @@ -24,7 +24,7 @@ public interface IGridWorldIndexer3 - public struct GridLevelIndex + [Serializable] public struct GridLevelIndex { public Vector3i block_index; public Vector3i local_index; @@ -66,7 +66,7 @@ public interface IMultigridIndexer3 /// /// Map to/from grid coords /// - public struct ScaleGridIndexer3 : IGridWorldIndexer3 + [Serializable] public struct ScaleGridIndexer3 : IGridWorldIndexer3 { public double CellSize; @@ -109,7 +109,7 @@ public Vector3d FromGrid(Vector3d gridpointf) { /// /// Map to/from grid coords, where grid is translated from origin /// - public struct ShiftGridIndexer3 : IGridWorldIndexer3 + [Serializable] public struct ShiftGridIndexer3 : IGridWorldIndexer3 { public Vector3d Origin; public double CellSize; @@ -154,7 +154,7 @@ public Vector3d FromGrid(Vector3d gridpointf) { /// /// Map to/from grid coords, where grid is relative to frame coords/axes /// - public struct FrameGridIndexer3 : IGridWorldIndexer3 + [Serializable] public struct FrameGridIndexer3 : IGridWorldIndexer3 { public Frame3f GridFrame; public Vector3f CellSize; @@ -197,7 +197,7 @@ public Vector3d FromGrid(Vector3d gridpointf) /// map between "outer" (ie higher-res) grid coordinates and /// "blocks" of those coordinates. /// - public struct MultigridIndexer3 : IMultigridIndexer3 + [Serializable] public struct MultigridIndexer3 : IMultigridIndexer3 { public Vector3i OuterShift; public Vector3i BlockSize; diff --git a/spatial/GridIndexing2.cs b/spatial/GridIndexing2.cs index 2f9a9a7b..deeb568a 100644 --- a/spatial/GridIndexing2.cs +++ b/spatial/GridIndexing2.cs @@ -21,7 +21,7 @@ public interface IGridWorldIndexer2 - public struct GridLevelIndex2 + [Serializable] public struct GridLevelIndex2 { public Vector2i block_index; public Vector2i local_index; @@ -63,7 +63,7 @@ public interface IMultigridIndexer2 /// /// Map to/from grid coords /// - public struct ScaleGridIndexer2 : IGridWorldIndexer2 + [Serializable] public struct ScaleGridIndexer2 : IGridWorldIndexer2 { public double CellSize; @@ -96,7 +96,7 @@ public Vector2d FromGrid(Vector2d gridpointf) { /// /// Map to/from grid coords, where grid is translated from origin /// - public struct ShiftGridIndexer2 : IGridWorldIndexer2 + [Serializable] public struct ShiftGridIndexer2 : IGridWorldIndexer2 { public Vector2d Origin; public double CellSize; @@ -131,7 +131,7 @@ public Vector2d FromGrid(Vector2d gridpointf) { /// map between "outer" (ie higher-res) grid coordinates and /// "blocks" of those coordinates. /// - public struct MultigridIndexer2 : IMultigridIndexer2 + [Serializable] public struct MultigridIndexer2 : IMultigridIndexer2 { public Vector2i OuterShift; public Vector2i BlockSize; diff --git a/spatial/MeshScalarSamplingGrid.cs b/spatial/MeshScalarSamplingGrid.cs index 927c4ce8..2f66908b 100644 --- a/spatial/MeshScalarSamplingGrid.cs +++ b/spatial/MeshScalarSamplingGrid.cs @@ -21,7 +21,7 @@ namespace gs /// are keeping track of active edges instead of active cells? /// /// - public class MeshScalarSamplingGrid + [Serializable] public class MeshScalarSamplingGrid { public DMesh3 Mesh; public Func ScalarF; @@ -34,7 +34,7 @@ public class MeshScalarSamplingGrid // Should we compute values at all grid cells (expensive!!) or only in narrow band. // In narrow-band mode, we guess rest of values by propagating along x-rows - public enum ComputeModes + [Serializable] public enum ComputeModes { FullGrid = 0, NarrowBand = 1 diff --git a/spatial/MeshSignedDistanceGrid.cs b/spatial/MeshSignedDistanceGrid.cs index ec98da68..62795284 100644 --- a/spatial/MeshSignedDistanceGrid.cs +++ b/spatial/MeshSignedDistanceGrid.cs @@ -37,7 +37,7 @@ namespace g3 /// Original license was public domain. /// Permission granted by Christopher Batty to include C# port under Boost license. /// - public class MeshSignedDistanceGrid + [Serializable] public class MeshSignedDistanceGrid { public DMesh3 Mesh; public DMeshAABBTree3 Spatial; @@ -58,7 +58,7 @@ public class MeshSignedDistanceGrid // Can also fill in the rest of the full grid with fast sweeping. This is // quite computationally intensive, though, and not parallelizable // (time only depends on grid resolution) - public enum ComputeModes + [Serializable] public enum ComputeModes { FullGrid = 0, NarrowBandOnly = 1, @@ -80,7 +80,7 @@ public enum ComputeModes // Parity count is basically mesh winding number, handles overlap shells and // self-intersections, but inverted shells are 'subtracted', and inverted faces are a disaster. // Both modes handle internal cavities, neither handles open sheets. - public enum InsideModes + [Serializable] public enum InsideModes { CrossingCount = 0, ParityCount = 1 diff --git a/spatial/MeshWindingNumberGrid.cs b/spatial/MeshWindingNumberGrid.cs index ebddcb1a..19e5ac02 100644 --- a/spatial/MeshWindingNumberGrid.cs +++ b/spatial/MeshWindingNumberGrid.cs @@ -21,7 +21,7 @@ namespace gs /// are keeping track of active edges instead of active cells? /// /// - public class MeshWindingNumberGrid + [Serializable] public class MeshWindingNumberGrid { public DMesh3 Mesh; public DMeshAABBTree3 MeshSpatial; @@ -34,7 +34,7 @@ public class MeshWindingNumberGrid // Should we compute MWN at all grid cells (expensive!!) or only in narrow band. // In narrow-band mode, we guess rest of MWN values by propagating along x-rows - public enum ComputeModes + [Serializable] public enum ComputeModes { FullGrid = 0, NarrowBand = 1 diff --git a/spatial/NormalHistogram.cs b/spatial/NormalHistogram.cs index 77ab6cf0..9a934f87 100644 --- a/spatial/NormalHistogram.cs +++ b/spatial/NormalHistogram.cs @@ -9,7 +9,7 @@ namespace g3 /// Construct spherical histogram of normals of mesh. /// Binning is done using a Spherical Fibonacci point set. /// - public class NormalHistogram + [Serializable] public class NormalHistogram { public int Bins = 1024; public SphericalFibonacciPointSet Points; diff --git a/spatial/PointAABBTree3.cs b/spatial/PointAABBTree3.cs index 2b8af555..97da98d3 100644 --- a/spatial/PointAABBTree3.cs +++ b/spatial/PointAABBTree3.cs @@ -13,7 +13,7 @@ namespace g3 /// TODO: no timestamp support right now... /// /// - public class PointAABBTree3 + [Serializable] public class PointAABBTree3 { IPointSet points; int points_timestamp; @@ -38,7 +38,7 @@ public PointAABBTree3(IPointSet pointsIn, bool autoBuild = true) public int LeafMaxPointCount = 32; // how should we build the tree? - public enum BuildStrategy + [Serializable] public enum BuildStrategy { Default, // currently TopDownMidpoint @@ -136,7 +136,7 @@ protected void find_nearest_point(int iBox, Vector3d p, ref double fNearestSqr, /// that branch of the traversal, or true to descend into that box's children (boxes or points). /// NextPointF() is called for each point. /// - public class TreeTraversal + [Serializable] public class TreeTraversal { // return false to terminate this branch // arguments are box and depth in tree diff --git a/spatial/PointHashGrid2d.cs b/spatial/PointHashGrid2d.cs index dd61611f..bb832c38 100644 --- a/spatial/PointHashGrid2d.cs +++ b/spatial/PointHashGrid2d.cs @@ -15,7 +15,7 @@ namespace g3 /// you must also know it's 2D coordinate, so we can look up the cell coordinates. /// Hence, to 'update' a point, you need to know both it's old and new 2D coordinates. /// - public class PointHashGrid2d + [Serializable] public class PointHashGrid2d { Dictionary> Hash; ScaleGridIndexer2 Indexer; diff --git a/spatial/PointHashGrid3d.cs b/spatial/PointHashGrid3d.cs index e8e757e6..d3466282 100644 --- a/spatial/PointHashGrid3d.cs +++ b/spatial/PointHashGrid3d.cs @@ -20,7 +20,7 @@ namespace g3 /// big, we build a sub-hash there? /// /// - public class PointHashGrid3d + [Serializable] public class PointHashGrid3d { Dictionary> Hash; ScaleGridIndexer3 Indexer; diff --git a/spatial/PointSetHashtable.cs b/spatial/PointSetHashtable.cs index 0805dc16..fe0fff20 100644 --- a/spatial/PointSetHashtable.cs +++ b/spatial/PointSetHashtable.cs @@ -6,7 +6,7 @@ namespace gs { - public class PointSetHashtable + [Serializable] public class PointSetHashtable { IPointSet Points; DSparseGrid3 Grid; @@ -104,7 +104,7 @@ public bool FindInBall(Vector3d pt, double r, int[] buffer, out int buffer_count - public class PointList : List, IGridElement3 { + [Serializable] public class PointList : List, IGridElement3 { public IGridElement3 CreateNewGridElement(bool bCopy) { return new PointList(); } diff --git a/spatial/Polygon2dBoxTree.cs b/spatial/Polygon2dBoxTree.cs index b400e677..c7f6b1a4 100644 --- a/spatial/Polygon2dBoxTree.cs +++ b/spatial/Polygon2dBoxTree.cs @@ -7,7 +7,7 @@ namespace g3 { - public class GeneralPolygon2dBoxTree + [Serializable] public class GeneralPolygon2dBoxTree { public GeneralPolygon2d Polygon; @@ -81,7 +81,7 @@ public Vector2d NearestPoint(Vector2d pt) /// [TODO] would it make more sense to have more than just 2 segments at lowest level? /// /// - public class Polygon2dBoxTree + [Serializable] public class Polygon2dBoxTree { public Polygon2d Polygon; diff --git a/spatial/SegmentHashGrid.cs b/spatial/SegmentHashGrid.cs index 2ef1f272..a360c7a5 100644 --- a/spatial/SegmentHashGrid.cs +++ b/spatial/SegmentHashGrid.cs @@ -22,7 +22,7 @@ namespace g3 /// you must also know it's 2D center, so we can look up the cell coordinates. /// Hence, to 'update' a segment, you need to know both it's old and new 2D centers. /// - public class SegmentHashGrid2d + [Serializable] public class SegmentHashGrid2d { Dictionary> Hash; ScaleGridIndexer2 Indexer; diff --git a/spatial/SegmentSet2d.cs b/spatial/SegmentSet2d.cs index ee286129..43259f43 100644 --- a/spatial/SegmentSet2d.cs +++ b/spatial/SegmentSet2d.cs @@ -4,7 +4,7 @@ namespace g3 { // [TODO] some kind of spatial sorting!! - public class SegmentSet2d + [Serializable] public class SegmentSet2d { List Segments; diff --git a/spatial/SpatialFunctions.cs b/spatial/SpatialFunctions.cs index f99b1a4d..878ab6b1 100644 --- a/spatial/SpatialFunctions.cs +++ b/spatial/SpatialFunctions.cs @@ -14,7 +14,7 @@ public static class SpatialFunctions // various offset-surface functions, in class so the compute functions // can be passed to other functions [System.Obsolete("NormalOffset is deprecated - is anybody using it? please lmk.")] - public class NormalOffset + [Serializable] public class NormalOffset { public DMesh3 Mesh; public ISpatial Spatial; diff --git a/spatial/TriangleBinsGrid2d.cs b/spatial/TriangleBinsGrid2d.cs index 1d3484fc..023e1426 100644 --- a/spatial/TriangleBinsGrid2d.cs +++ b/spatial/TriangleBinsGrid2d.cs @@ -20,7 +20,7 @@ namespace g3 /// overlaps. Need conservative rasterization to improve this. Can implement by /// testing each bin bbox for intersection w/ triangle /// - public class TriangleBinsGrid2d + [Serializable] public class TriangleBinsGrid2d { ShiftGridIndexer2 indexer; AxisAlignedBox2d bounds;