Skip to content
Snippets Groups Projects
Commit 09f48235 authored by BenniHome's avatar BenniHome
Browse files

ITS ALIVE

parent 7fdd3c1a
No related branches found
No related tags found
No related merge requests found
fileFormatVersion: 2
guid: 546b5a29afa8bd446ba254c04097d626
guid: eec83b50c1e0c604aa91430f72c8dbb0
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
......@@ -7,6 +7,10 @@ public abstract class Fact
public GameObject Representation;
public string backendURI;
public string backendValueURI; // supposed to be null, for Facts without values eg. Points, OpenLines, OnLineFacts...
public string format(float t) {
return t.ToString("0.0000").Replace(',', '.');
}
}
public class AddFactResponse
......@@ -48,7 +52,8 @@ public PointFact(int i,Vector3 P, Vector3 N) {
this.Point = P;
this.Normal = N;
string body = @"{ ""a"":" +P.x + @"," + @"""b"":" +P.y + @","+@"""c"":" + P.z + "}";
string body = @"{ ""a"":" +format(P.x) + @"," + @"""b"":" + format(P.y) + @","+@"""c"":" + format(P.y) + "}";
Debug.Log(body);
AddFactResponse res = AddFactResponse.sendAdd("localhost:8081/fact/add/vector", body);
this.backendURI = res.factUri;
......@@ -88,8 +93,8 @@ public LineFact(int i, int pid1, int pid2) {
PointFact pf2 = CommunicationEvents.Facts.Find((x => x.Id == pid2)) as PointFact;
string p1URI = pf1.backendURI;
string p2URI = pf2.backendURI;
double v = (pf1.Point - pf2.Point).magnitude;
string body = @"{ ""pointA"":""" + p1URI + @"""," + @"""pointB"":""" + p2URI + @"""," + @"""value"":" + v + "}";
float v = (pf1.Point - pf2.Point).magnitude;
string body = @"{ ""pointA"":""" + p1URI + @"""," + @"""pointB"":""" + p2URI + @"""," + @"""value"":" + format(v) + "}";
AddFactResponse res = AddFactResponse.sendAdd("localhost:8081/fact/add/distance", body);
this.backendURI = res.factUri;
this.backendValueURI = res.factValUri;
......@@ -123,13 +128,17 @@ public AngleFact(int i, int pid1, int pid2, int pid3)
PointFact pf1 = CommunicationEvents.Facts.Find((x => x.Id == pid1)) as PointFact;
PointFact pf2 = CommunicationEvents.Facts.Find((x => x.Id == pid2)) as PointFact;
PointFact pf3 = CommunicationEvents.Facts.Find((x => x.Id == pid3)) as PointFact;
double v = Vector3.Angle((pf1.Point - pf2.Point), (pf1.Point - pf2.Point));
float v = Vector3.Angle((pf1.Point - pf2.Point), (pf3.Point - pf2.Point));
if (Mathf.Abs(v - 90.0f) < 0.01) v = 90.0f;
Debug.Log("angle: " + v);
string body = @"{" +
@"""left"":""" + pf1.backendURI + @"""," +
@"""middle"":""" + pf2.backendURI + @"""," +
@"""right"":""" + pf3.backendURI + @"""," +
@"""value"":" + v +
@"""value"":" + format(v) +
"}";
Debug.Log(body);
AddFactResponse res = AddFactResponse.sendAdd("localhost:8081/fact/add/angle", body);
this.backendURI = res.factUri;
this.backendValueURI = res.factValUri;
......
......@@ -117,6 +117,8 @@ class PushoutReturn {
public string newSituation;
public PushoutFact[] outputs;
}
[System.Serializable]
public class PushoutFact {
// generic class to make a common Supertype for all PushoutResponses
public string uri;
......@@ -195,6 +197,7 @@ private string pushout(string view) {
}
private void readPushout(string txt) {
Debug.Log(txt);
PushoutReturn ret = JsonUtility.FromJson<PushoutReturn>(txt);
this.situationTheory = ret.newSituation;
FactManager factManager = cursor.GetComponent<FactManager>();
......
fileFormatVersion: 2
guid: df10919d3230595438beac5071d21387
guid: ac72be71662640f4ab0aaf102090fb95
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
# UFrameIT
the new unity-based implementation of FrameIT
to make things work, pleas follow the following steps:
- download the whole mathhub directory:
https://drive.google.com/open?id=1Vd7nHCRRRSo6NnvgDSz98V6lOdIm92KA
- download the FrameIt-MMT-Server.jar :
https://drive.google.com/open?id=12aCu3LgXUuv96TAKL705BK9_45ytrv4q
- call :
java -jar FrameIt-MMT-Server.jar <path to mathhub-dir> 8081
-press play in Unity.
The Code of the Server is hosted here:
https://github.com/bBoesl/UFrameTt_Server
The FrameIt-Specific MMT files can be found here:
https://github.com/bBoesl/UFrameIt-MMT
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment