use of spacegraph.space2d.container.EdgeDirected in project narchy by automenta.
the class DynamicListSpace method show.
/**
* displays in a window with default force-directed options
*/
@Deprecated
public SpaceGraphPhys3D show(int w, int h, boolean flat) {
// new SpaceTransform<Term>() {
// @Override
// public void update(SpaceGraph<Term> g, AbstractSpace<Term, ?> src, float dt) {
// float cDepth = -9f;
// src.forEach(s -> {
// ((SimpleSpatial)s).moveZ(
// s.key.volume() * cDepth, 0.05f );
// });
// }
// }
// new Spiral()
// //new FastOrganicLayout()
AbstractSpace ss = flat ? with(new Flatten(0.25f, 0.25f)) : this;
SpaceGraphPhys3D<X> s = new SpaceGraphPhys3D<>(ss);
EdgeDirected fd = new EdgeDirected();
s.dyn.addBroadConstraint(fd);
fd.attraction.set(fd.attraction.get() * 8);
// s.ortho(Vis.logConsole(nar, 90, 40, new FloatParam(0f)).opacity(0.25f));
// Vis.conceptsWindow2D
// .ortho(logConsole( n, 90, 40, new FloatParam(0f)).opacity(0.25f))
s.camPos(0, 0, 90).show(w, h);
return s;
}
use of spacegraph.space2d.container.EdgeDirected in project narchy by automenta.
the class NAgentX method chart.
public static void chart(NAgent a) {
NAR nar = a.nar();
nar.runLater(() -> {
SpaceGraph.window(grid(new AutoSurface(a), Vis.beliefCharts(nar.dur() * 64, a.actions.keySet(), a.nar()), new EmotionPlot(64, a), grid(// concept query box
new TextEdit() {
@Override
protected void onKeyEnter() {
String s = text();
text("");
try {
nar.conceptualize(s);
} catch (Narsese.NarseseException e) {
e.printStackTrace();
}
Vis.conceptWindow(s, nar);
}
}.surface(), // new WindowButton("log", () -> Vis.logConsole(nar, 80, 25, new FloatParam(0f))),
new PushButton("dump", () -> {
try {
nar.output(Files.createTempFile(a.toString(), "" + System.currentTimeMillis()).toFile(), false);
} catch (IOException e) {
e.printStackTrace();
}
}), new PushButton("clear", () -> {
nar.runLater(NAR::clear);
}), new PushButton("prune", () -> {
nar.runLater(() -> {
DoubleHistogram i = new DoubleHistogram(2);
nar.tasks(true, false, false, false).forEach(t -> i.recordValue(t.conf()));
float confThresh = (float) i.getValueAtPercentile(25);
nar.tasks(true, false, false, false).filter(t -> t.conf() < confThresh).forEach(Task::delete);
});
}), new WindowToggleButton("top", () -> new ConsoleTerminal(new nars.TextUI(nar).session(10f))), new WindowToggleButton("concept graph", () -> {
DynamicConceptSpace sg;
SpaceGraphPhys3D s = new SpaceGraphPhys3D<>(sg = new DynamicConceptSpace(nar, () -> nar.exe.active().iterator(), 128, 16));
EdgeDirected fd = new EdgeDirected();
s.dyn.addBroadConstraint(fd);
fd.attraction.set(fd.attraction.get() * 8);
s.add(new SubOrtho(// window(
grid(new AutoSurface<>(fd), new AutoSurface<>(sg.vis))) {
}.posWindow(0, 0, 1f, 0.2f));
// , 400, 400);
// .pos(0, 0, 0.5f, 0.5f)
s.camPos(0, 0, 90);
return s;
}), a instanceof NAgentX ? new WindowToggleButton("vision", () -> grid(((NAgentX) a).sensorCam.stream().map(cs -> new AspectAlign(new CameraSensorView(cs, a).withControls(), AspectAlign.Align.Center, cs.width, cs.height)).toArray(Surface[]::new))) : grid())), //
900, 600);
});
}
Aggregations