Skip to content

Adding [Serializable] attribute to geometry3Sharp objects to allow Bi… #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion approximation/BiArcFit2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion approximation/GaussPointsFit3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Real> just to have a
// single container.
public class GaussPointsFit3
[Serializable] public class GaussPointsFit3
{
public Box3d Box;
public bool ResultValid = false;
Expand Down
2 changes: 1 addition & 1 deletion approximation/OrthogonalPlaneFit3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion color/ColorHSV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace g3
{
public class ColorHSV
[Serializable] public class ColorHSV
{
public float h;
public float s;
Expand Down
2 changes: 1 addition & 1 deletion color/ColorMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace g3
{
public class ColorMap
[Serializable] public class ColorMap
{
struct ColorPoint
{
Expand Down
2 changes: 1 addition & 1 deletion color/Colorb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace g3
{
public struct Colorb
[Serializable] public struct Colorb
{
public byte r;
public byte g;
Expand Down
2 changes: 1 addition & 1 deletion color/Colorf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace g3
{
public struct Colorf : IComparable<Colorf>, IEquatable<Colorf>
[Serializable] public struct Colorf : IComparable<Colorf>, IEquatable<Colorf>
{
public float r;
public float g;
Expand Down
2 changes: 1 addition & 1 deletion comp_geom/Arrangement2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace g3
/// [TODO] maybe smarter handling
///
/// </summary>
public class Arrangement2d
[Serializable] public class Arrangement2d
{
// graph of arrangement
public DGraph2 Graph;
Expand Down
2 changes: 1 addition & 1 deletion comp_geom/ConvexHull2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace g3
///
/// HullIndices provides ordered indices of vertices of input points that form hull.
/// </summary>
public class ConvexHull2
[Serializable] public class ConvexHull2
{
//QueryNumberType mQueryType = QueryNumberType.QT_DOUBLE;
IList<Vector2d> mVertices;
Expand Down
2 changes: 1 addition & 1 deletion comp_geom/GraphCells2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace g3
/// oriented clockwise, if converted to a Polygon2d.
///
/// </summary>
public class GraphCells2d
[Serializable] public class GraphCells2d
{
public DGraph2 Graph;

Expand Down
2 changes: 1 addition & 1 deletion comp_geom/GraphSplitter2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
public class GraphSplitter2d
[Serializable] public class GraphSplitter2d
{
public DGraph2 Graph;

Expand Down
2 changes: 1 addition & 1 deletion comp_geom/SphericalFibonacciPointSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace g3
///
/// math from http://lgdv.cs.fau.de/uploads/publications/spherical_fibonacci_mapping_opt.pdf
/// </summary>
public class SphericalFibonacciPointSet
[Serializable] public class SphericalFibonacciPointSet
{
public int N = 64;

Expand Down
2 changes: 1 addition & 1 deletion containment/ContBox3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion containment/ContMinBox2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace g3
/// <summary>
/// Fit minimal bounding-box to a set of 2D points. Result is in MinBox.
/// </summary>
public class ContMinBox2
[Serializable] public class ContMinBox2
{
Box2d mMinBox;

Expand Down
2 changes: 1 addition & 1 deletion containment/ContMinCircle2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace g3
/// <summary>
/// Fit minimal bounding-circle to a set of 2D points
/// </summary>
public class ContMinCircle2
[Serializable] public class ContMinCircle2
{
double mEpsilon;
Func<int, int[], Support, Circle>[] mUpdate = new Func<int, int[], Support, Circle>[4];
Expand Down
4 changes: 2 additions & 2 deletions core/BufferUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace g3
/// - byte[] conversions
/// - zlib compress/decompress byte[] buffers
/// </summary>
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;
Expand Down Expand Up @@ -561,7 +561,7 @@ static public byte[] DecompressZLib(byte[] zBuffer)
/// T * ptr = &array[i];
/// ptr[k] = value
/// </summary>
public struct ArrayAlias<T>
[Serializable] public struct ArrayAlias<T>
{
public T[] Source;
public int Index;
Expand Down
2 changes: 1 addition & 1 deletion core/CommandArgumentSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions core/DVector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> : IEnumerable<T>
[Serializable] public class DVector<T> : IEnumerable<T>
{
List<T[]> Blocks;
int iCurBlock;
Expand Down Expand Up @@ -408,7 +408,7 @@ IEnumerator IEnumerable.GetEnumerator() {


// block iterator
public struct DBlock
[Serializable] public struct DBlock
{
public T[] data;
public int usedCount;
Expand Down
18 changes: 9 additions & 9 deletions core/DVectorArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> : IEnumerable<T>
[Serializable] public class DVectorArray3<T> : IEnumerable<T>
{
public DVector<T> vector;

Expand Down Expand Up @@ -67,7 +67,7 @@ IEnumerator IEnumerable.GetEnumerator()
}


public class DVectorArray3d : DVectorArray3<double>
[Serializable] public class DVectorArray3d : DVectorArray3<double>
{
const double invalid_value = -99999999.0;

Expand All @@ -87,7 +87,7 @@ public IEnumerable<Vector3d> AsVector3d() {
};


public class DVectorArray3f : DVectorArray3<float>
[Serializable] public class DVectorArray3f : DVectorArray3<float>
{
public DVectorArray3f(int nCount = 0) : base(nCount) { }
public DVectorArray3f(float[] data) : base(data) { }
Expand All @@ -104,7 +104,7 @@ public IEnumerable<Vector3f> AsVector3f()
};


public class DVectorArray3i : DVectorArray3<int>
[Serializable] public class DVectorArray3i : DVectorArray3<int>
{
public DVectorArray3i(int nCount = 0) : base(nCount) { }
public DVectorArray3i(int[] data) : base(data) { }
Expand Down Expand Up @@ -133,7 +133,7 @@ public IEnumerable<Vector3i> AsVector3i()



public class DIndexArray3i : DVectorArray3<int>
[Serializable] public class DIndexArray3i : DVectorArray3<int>
{
public DIndexArray3i(int nCount = 0) : base(nCount) { }
public DIndexArray3i(int[] data) : base(data) { }
Expand Down Expand Up @@ -167,7 +167,7 @@ public IEnumerable<Index3i> AsIndex3i()
//
// Same as DVectorArray3, but for 2D vectors/etc
//
public class DVectorArray2<T> : IEnumerable<T>
[Serializable] public class DVectorArray2<T> : IEnumerable<T>
{
public DVector<T> vector;

Expand Down Expand Up @@ -217,7 +217,7 @@ IEnumerator IEnumerable.GetEnumerator()
return this.GetEnumerator();
}
}
public class DVectorArray2d : DVectorArray2<double>
[Serializable] public class DVectorArray2d : DVectorArray2<double>
{
public DVectorArray2d(int nCount = 0) : base(nCount) { }
public DVectorArray2d(double[] data) : base(data) { }
Expand All @@ -231,7 +231,7 @@ public IEnumerable<Vector2d> AsVector2d() {
yield return this[i];
}
};
public class DVectorArray2f : DVectorArray2<float>
[Serializable] public class DVectorArray2f : DVectorArray2<float>
{
public DVectorArray2f(int nCount = 0) : base(nCount) { }
public DVectorArray2f(float[] data) : base(data) { }
Expand All @@ -248,7 +248,7 @@ public IEnumerable<Vector2d> AsVector2f() {



public class DIndexArray2i : DVectorArray2<int>
[Serializable] public class DIndexArray2i : DVectorArray2<int>
{
public DIndexArray2i(int nCount = 0) : base(nCount) { }
public DIndexArray2i(int[] data) : base(data) { }
Expand Down
2 changes: 1 addition & 1 deletion core/DijkstraGraphDistance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace g3
/// - MeshVertices(mesh) - compute on vertices of mesh
///
/// </summary>
public class DijkstraGraphDistance
[Serializable] public class DijkstraGraphDistance
{
public const float InvalidValue = float.MaxValue;

Expand Down
2 changes: 1 addition & 1 deletion core/DynamicPriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class DynamicPriorityQueueNode
///
/// conceptually based on https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp
/// </summary>
public class DynamicPriorityQueue<T> : IEnumerable<T>
[Serializable] public class DynamicPriorityQueue<T> : IEnumerable<T>
where T : DynamicPriorityQueueNode
{
// set this to true during development to catch issues
Expand Down
2 changes: 1 addition & 1 deletion core/HBitArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// </summary>
public class HBitArray : IEnumerable<int>
[Serializable] public class HBitArray : IEnumerable<int>
{
struct MyBitVector32
{
Expand Down
2 changes: 1 addition & 1 deletion core/HashUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace g3
///
/// (should probably be using uint? but standard GetHashCode() returns int...)
/// </summary>
public struct HashBuilder
[Serializable] public struct HashBuilder
{
public int Hash;

Expand Down
2 changes: 1 addition & 1 deletion core/IndexPriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace g3
///
/// conceptually based on https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp
/// </summary>
public class IndexPriorityQueue : IEnumerable<int>
[Serializable] public class IndexPriorityQueue : IEnumerable<int>
{
// set this to true during development to catch issues
public bool EnableDebugChecks = false;
Expand Down
14 changes: 7 additions & 7 deletions core/Indexing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>
[Serializable] public class IndexRangeEnumerator : IEnumerable<int>
{
int Start = 0;
int Count = 0;
Expand All @@ -27,7 +27,7 @@ IEnumerator IEnumerable.GetEnumerator() {


// Add true/false operator[] to integer HashSet
public class IndexHashSet : HashSet<int>
[Serializable] public class IndexHashSet : HashSet<int>
{
public bool this[int key]
{
Expand All @@ -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
/// </summary>
public class IndexFlagSet : IEnumerable<int>
[Serializable] public class IndexFlagSet : IEnumerable<int>
{
BitArray bits;
HashSet<int> hash;
Expand Down Expand Up @@ -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; }
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/MemoryPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace g3
/// <summary>
/// Very basic object pool class.
/// </summary>
public class MemoryPool<T> where T : class, new()
[Serializable] public class MemoryPool<T> where T : class, new()
{
DVector<T> Allocated;
DVector<T> Free;
Expand Down
4 changes: 2 additions & 2 deletions core/ProfileUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace g3
{

public class BlockTimer
[Serializable] public class BlockTimer
{
public Stopwatch Watch;
public string Label;
Expand Down Expand Up @@ -71,7 +71,7 @@ public static string TimeFormatString(TimeSpan span)



public class LocalProfiler : IDisposable
[Serializable] public class LocalProfiler : IDisposable
{
Dictionary<string, BlockTimer> Timers = new Dictionary<string, BlockTimer>();
List<string> Order = new List<string>();
Expand Down
Loading