-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point3D.cs
84 lines (78 loc) · 1.62 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace STLLoader
{
class Point3D
{
private float x, y, z;
//properties
public float X
{
get
{
return x;
}
set
{
x = value;
}
}
public float Y
{
get
{
return y;
}
set
{
y = value;
}
}
public float Z
{
get
{
return z;
}
set
{
z = value;
}
}
//functions
public Point3D()
{
this.x = this.y = this.z = 0;
}
public Point3D(float v)
{
this.x = this.y = this.z = v;
}
public Point3D(Point3D p)
{
this.x = p.x;
this.y = p.y;
this.z = p.z;
}
public Point3D(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = 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 p, float f)
{
return new Point3D(p.X / f, p.Y / f, p.Z / f);
}
public override string ToString()
{
return x + "," + y + "," + z;
}
}
}