-
Notifications
You must be signed in to change notification settings - Fork 5
/
Point3D.cs
66 lines (52 loc) · 1.19 KB
/
Point3D.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Text;
namespace las.datamanager.structures
{
[Serializable]
public struct Point3D
{
public float x;
public float y;
public float z;
public float nx;
public float ny;
public float nz;
public byte colorIndex;
public bool pointAvailable; //flag for used in multiresolution LOD
public float Length
{
get
{
return (float)Math.Sqrt(x * x + y * y + z * z);
}
private set
{
;
}
}
public Point3D(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
this.nx = 0;
this.ny = 0;
this.nz = 0;
colorIndex = 0;
pointAvailable = false;
}
public float SquareDistance(Point3D other)
{
return (x - other.x) * (x - other.x) + (y - other.y) * (y - other.y) + (z - other.z) * (z - other.z);
}
public static Point3D operator +(Point3D p1, Point3D p2)
{
return new Point3D(p1.x+p2.x, p1.y+p2.y, p1.z+p2.z);
}
public static Point3D operator -(Point3D p1, Point3D p2)
{
return new Point3D(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
}
}
}