clean up old unused tests

This commit is contained in:
Val Erastov 2016-12-21 23:50:57 -08:00
parent a57f2fcf46
commit a2e90819b7
5 changed files with 0 additions and 120 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,21 +0,0 @@
function test1() {
var face;
var app = window._TCAD_APP;
face = app.findFace('0:2');
app.craft.modify({
type: 'CUT',
solids : [face.solid],
face : face,
params : {target : face.basis()[2].multiply(-250), expansionFactor : 2.5}
});
face = app.findFace('0:4');
app.craft.modify({
type: 'CUT',
solids : [face.solid],
face : face,
params : {target : face.basis()[2].multiply(-550), expansionFactor : 1}
});
}

View file

@ -1,15 +0,0 @@
require("./headless-loader.js");
function testReconstruct0() {
}
testReconstruct0();
var face = face4;
var polygons2D = face.polygons.map(csgPolyToSimple).map(polygonTransform(basisTransformation(face.basis)));
var csgPolygons = polygons2D.map(function(p) {return new CSG.Polygon( p.map(function(v) { return new CSG.Vertex(new CSG.Vector3D(v));}) )} );
var outline = TCAD.craft.findOutline(csgPolygons);
viz("1", polygons2D, outline);

View file

@ -1,76 +0,0 @@
TCAD = {};
require("../engine.js");
require("../math/vector.js");
require("../math/math.js");
require("../workbench.js");
require("../math/graph.js");
require("../3d/hashmap.js");
CSG = require("../../lib/csg.js").CSG;
require("./craft-fixtures.js");
var assert = require('assert');
viz = function(name, polygons, segments, outline) {
var colors = ['aqua', 'black', 'blue', 'brown', 'crimson', 'gray', 'green', 'lemon', 'lime', 'olive', 'orange', 'peach', 'pink', 'purple', 'salmon', 'tan', 'teal', 'violet', 'violet', 'blue', 'white', 'yellow'];
var bbox = new TCAD.BBox();
var fs = require('fs');
var builder = require('xmlbuilder');
var svgNode = builder.create('html')
.ele('body')
.ele('svg', {width: 800, height: 600});
var svg = svgNode.ele('g', {'transform': 'scale(1,-1)'});
for (var pi = 0; pi < polygons.length; ++ pi) {
var poly = polygons[pi];
var pointsStr = "";
for (var pointIdx = 0; pointIdx < poly.length; ++ pointIdx) {
pointsStr += " " + poly[pointIdx].x + "," + poly[pointIdx].y;
bbox.checkBounds(poly[pointIdx].x, poly[pointIdx].y);
}
svg.ele('polygon', {points: pointsStr, style:"fill:"+colors[pi % colors.length]});
}
for (var si = 0; si < segments.length; ++ si) {
var s = segments[si];
svg.ele('line', {x1 : s[0].x, y1 : s[0].y, x2 : s[1].x, y2 : s[1].y, stroke:'magenta', 'stroke-width':'2'});
svg.ele('ellipse', {cx : s[0].x, cy : s[0].y, rx:3, ry:2, fill : "red"});
svg.ele('ellipse', {cx : s[1].x, cy : s[1].y, rx:2, ry:3, fill : "red"});
}
if (!!outline) {
var n = outline.length, p,q;
for (var p = n - 1, q = 0; q < n; p = q ++) {
var a = outline[p];
var b = outline[q];
svg.ele('line', {x1 : a.x, y1 : a.y, x2 : b.x, y2 : b.y, stroke:'red', 'stroke-width':'2'});
svg.ele('ellipse', {cx : a.x, cy : a.y, rx:3, ry:2, fill : "red"});
svg.ele('ellipse', {cx : b.x, cy : b.y, rx:2, ry:3, fill : "red"});
}
}
var length = Math.max(bbox.maxX - bbox.minX, bbox.maxY - bbox.minY) + 100;
svgNode.att('viewBox', (bbox.minX ) + " " + (bbox.minY + bbox.height() - bbox.height() * 0.2) + " " + length + " " + length)
var htmlText = svgNode.end({ pretty: true});
if (!fs.existsSync('viz')) fs.mkdirSync('viz', function(err) {});
fs.writeFile("viz/" + name + ".html", htmlText);
}
vertToPoint = function(v) {
return {x : v.pos._x, y : v.pos._y, z : v.pos._z};
}
csgPolyToSimple = function(p) {
return p.vertices.map(vertToPoint);
}
basisTransformation = function(basis) {
var tr = new TCAD.Matrix().setBasis(basis).invert();
return function(p) {
return tr.apply(p);
}
}
polygonTransform = function(tr) {
return function(polygon) {
return polygon.map(tr);
}
};

View file

@ -1,2 +0,0 @@
node ./craft-tests.js
open viz/1.html