use of org.twak.tweed.gen.WindowGen.Window in project chordatlas by twak.
the class GreebleGrid method createDormerWindow.
protected void createDormerWindow(QuadF l, MeshBuilder window, MeshBuilder glass, float sillDepth, float sillHeight, float corniceHeight, double panelWidth, double panelHeight) {
Vector3d along = new Vector3d(l.corners[3]);
along.sub(l.corners[0]);
along.normalize();
Vector3d up = new Vector3d(0, 1, 0);
Vector3d out = new Vector3d();
out.cross(along, up);
out.scale(1 / out.length());
Line3d lout;
{
Point3d away = new Point3d(l.corners[0]);
away.add(out);
lout = new Line3d(new Point3d(l.corners[0]), away);
}
Vector3d loc = new Vector3d(l.found[0]);
if (lout.findPPram(l.found[0]) < lout.findPPram(l.found[1])) {
// outwards going wall...
loc = new Vector3d(up);
loc.scale(-l.original.height);
loc.add(l.found[1]);
}
{
Vector3d avoidRoof = new Vector3d(out);
avoidRoof.scale(0.09);
;
loc.add(avoidRoof);
}
Point3d deepest = Arrays.stream(l.found).map(p -> new Pair<Point3d, Double>(p, lout.findPPram(p))).max((a, b) -> b.second().compareTo(a.second())).get().first();
double depth = lout.closestPointOn(deepest, false).distance(lout.closestPointOn(new Point3d(loc), false));
// MUtils.max(
// Math.abs (l.corners[0].distance( l.found[0] )),
// Math.abs (l.corners[1].distance( l.found[1] )),
// Math.abs (l.corners[2].distance( l.found[2] )),
// Math.abs (l.corners[3].distance( l.found[3] ))
// ) ;
WindowGen.createWindow(window, glass, new Window(Jme3z.to(loc), Jme3z.to(along), Jme3z.to(up), l.original.width, l.original.height, depth, panelWidth, panelHeight));
// Vector3f u = Jme3z.to(up), o = Jme3z.to( out );
// if (sillDepth > 0)
// window.addCube( Jme3z.to ( ptt[0] ).add( u.mult( -sillHeight + 0.01f ) ).add( o.mult( -sillDepth) ),
// Jme3z.to(out), Jme3z.to(along), Jme3z.to(up),
// (float)depth + sillDepth, (float)winPanel.width,(float) sillHeight );
//
// if (corniceHeight > 0)
// moulding( to3d, new DRectangle(winPanel.x, winPanel.getMaxY(), winPanel.width, corniceHeight), wall );
}
use of org.twak.tweed.gen.WindowGen.Window in project chordatlas by twak.
the class GreebleGrid method createWindow.
protected void createWindow(DRectangle winPanel, Matrix4d to3d, MeshBuilder wall, MeshBuilder window, MeshBuilder glass, double depth, float sillDepth, float sillHeight, float corniceHeight, double panelWidth, double panelHeight) {
Point2d[] pts = winPanel.points();
Point3d[] ptt = new Point3d[4];
for (int i = 0; i < 4; i++) {
ptt[i] = Pointz.to3(pts[i]);
to3d.transform(ptt[i]);
}
Vector3d along = new Vector3d(ptt[3]);
along.sub(ptt[0]);
along.normalize();
Vector3d up = new Vector3d(ptt[1]);
up.sub(ptt[0]);
up.normalize();
Vector3d out = new Vector3d();
out.cross(along, up);
out.scale(-1 / out.length());
Vector3d loc = new Vector3d();
loc.cross(along, up);
loc.scale(-depth / loc.length());
loc.add(ptt[0]);
WindowGen.createWindow(window, glass, new Window(Jme3z.to(loc), Jme3z.to(along), Jme3z.to(up), winPanel.width, winPanel.height, 0.3, panelWidth, panelHeight));
Vector3f u = Jme3z.to(up), o = Jme3z.to(out);
wall.addInsideRect(Jme3z.to(ptt[0]), o, Jme3z.to(along), u, (float) depth, (float) winPanel.width, (float) winPanel.height, null);
if (sillDepth > 0 && sillHeight > 0)
window.addCube(Jme3z.to(ptt[0]).add(u.mult(-sillHeight + 0.01f)).add(o.mult(-sillDepth)), Jme3z.to(out), Jme3z.to(along), Jme3z.to(up), (float) depth + sillDepth, (float) winPanel.width, (float) sillHeight);
if (corniceHeight > 0)
moulding(to3d, new DRectangle(winPanel.x, winPanel.getMaxY(), winPanel.width, corniceHeight), wall);
}
Aggregations