c14n_stl/c14n_stl.ts

61 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-08-28 00:06:37 +00:00
function cmz (x : string) : string {
return x === '-0' ? '0' : x;
}
class Vertex {
public x : string;
public y : string;
public z : string;
public key : number[];
constructor (_x : string, _y : string, _z : string) {
this.x = _x;
this.y = _y;
this.z = _z;
this.key = [parseFloat(_x), parseFloat(_y), parseFloat(_z)];
}
public compare (vka : number[], vkb : number[]) : number {
}
}
class Normal {
public dx : string;
public dy : string;
public dz : string;
constructor (_dx : string, _dy : string, _dz : string) {
this.dx = _dx;
this.dy = _dy;
this.dz = _dz;
}
}
class Facet {
public normal : Normal;
public key : number[];
constructor (_normal : Normal, _v1 : Vertex, _v2 : Vertex, _v3 : Vertex) {
this.normal = _normal;
}
}
/*
class Facet:
def __init__(self, normal, v1, v2, v3):
self.normal = normal
if v1.key < v2.key:
if v1.key < v3.key:
self.vertices = (v1, v2, v3) #v1 is the smallest
else:
self.vertices = (v3, v1, v2) #v3 is the smallest
else:
if v2.key < v3.key:
self.vertices = (v2, v3, v1) #v2 is the smallest
else:
self.vertices = (v3, v1, v2) #v3 is the smallest
def key(self):
return (self.vertices[0].x, self.vertices[0].y, self.vertices[0].z,
self.vertices[1].x, self.vertices[1].y, self.vertices[1].z,
self.vertices[2].x, self.vertices[2].y, self.vertices[2].z)
*/