c14n_stl/c14n_stl.js

47 lines
1.4 KiB
JavaScript

function cmz(x) {
return x === '-0' ? '0' : x;
}
var Vertex = /** @class */ (function () {
function Vertex(_x, _y, _z) {
this.x = _x;
this.y = _y;
this.z = _z;
this.key = [parseFloat(_x), parseFloat(_y), parseFloat(_z)];
}
return Vertex;
}());
var Normal = /** @class */ (function () {
function Normal(_dx, _dy, _dz) {
this.dx = _dx;
this.dy = _dy;
this.dz = _dz;
}
return Normal;
}());
var Facet = /** @class */ (function () {
function Facet(_normal, _v1, _v2, _v3) {
this.normal = _normal;
}
return Facet;
}());
/*
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)
*/