use of org.twak.tweed.gen.Prof in project chordatlas by twak.
the class HouseTool method clickedOn.
@Override
public void clickedOn(Spatial target, Vector3f loc, Vector2f cursorPosition) {
// (Line) new XStream().fromXML( new File( "/home/twak/data/regent/March_30/congo/1/line.xml" ) ));
MegaFeatures mf = new MegaFeatures(new Line(0, 0, 10, 0));
// FeatureCache.readFeatures( new File( "/home/twak/data/regent/March_30/congo/1/0" ), mf );
ImageFeatures imf = new ImageFeatures();
imf.mega = mf;
double[] minMax = new double[] { 0, 15, 0, 25 };
HalfMesh2.Builder builder = new HalfMesh2.Builder(SuperEdge.class, SuperFace.class);
builder.newPoint(new Point2d(minMax[0] + loc.x, minMax[3] + loc.z));
builder.newPoint(new Point2d(minMax[1] + loc.x, minMax[3] + loc.z));
builder.newPoint(new Point2d(minMax[1] + loc.x, minMax[2] + loc.z));
builder.newPoint(new Point2d(minMax[0] + loc.x, minMax[2] + loc.z));
builder.newFace();
HalfMesh2 mesh = builder.done();
Prof p = new Prof();
p.add(new Point2d(0, 0));
p.add(new Point2d(0, 20));
p.add(new Point2d(-5, 25));
boolean first = true;
for (HalfFace f : mesh) {
for (HalfEdge e : f) {
SuperEdge se = (SuperEdge) e;
se.prof = p;
MiniFacade mini = newMini(imf, se.length());
if (true) {
se.addMini(mini);
se.proceduralFacade = mf;
se.toEdit = mini;
if (first)
se.addMini(mini);
}
first = false;
}
SuperFace sf = (SuperFace) f;
sf.maxProfHeights = new ArrayList();
sf.maxProfHeights.add(Double.valueOf(100));
sf.height = 100;
}
SkelGen sg = new SkelGen(mesh, tweed, null);
tweed.frame.addGen(sg, true);
}
use of org.twak.tweed.gen.Prof in project chordatlas by twak.
the class SkelGen method moveToX0.
public static Prof moveToX0(Prof prof) {
Prof out = new Prof(prof);
double tol = 0.01;
if (out.get(1).y == tol && out.get(2).y == tol && out.size() >= 4) {
// post-process out steps :(
out.remove(0);
out.remove(0);
out.set(0, new Point2d(out.get(0).x, 0));
prof = out;
out = new Prof(prof);
}
Point2d first = out.get(0);
if (first.x > -100) {
// always move to origin
// if ( first.x > -1.5 ) { // move to origin
double offset = first.x;
out.clear();
for (Point2d p : prof) out.add(new Point2d(p.x - offset, p.y));
} else {
// add "step" and keep it where it is
first.y = tol;
out.add(0, new Point2d(0.0, tol));
out.add(0, new Point2d(0, 0));
}
return out;
}
use of org.twak.tweed.gen.Prof in project chordatlas by twak.
the class SkelGen method toProf.
private Prof toProf(Profile profile) {
List<Point2d> pts = profile.points.get(0).stream().map(b -> new Point2d(-b.end.x, -b.end.y)).collect(Collectors.toList());
pts.add(0, new Point2d());
Prof prof = new Prof();
for (Point2d p : pts) prof.add(p);
return prof;
}
Aggregations