diff --git a/Assets/InventoryStuff/Inventory/Scripts.meta b/Assets/Graphics.meta similarity index 77% rename from Assets/InventoryStuff/Inventory/Scripts.meta rename to Assets/Graphics.meta index a14c26313e76244bc5874a73ea526e7b98e21de1..2f27852dee817f89c3c9f3c670d67c4e8a201894 100644 --- a/Assets/InventoryStuff/Inventory/Scripts.meta +++ b/Assets/Graphics.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 546b5a29afa8bd446ba254c04097d626 +guid: eec83b50c1e0c604aa91430f72c8dbb0 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/InteractionEngine/Fact.cs b/Assets/InteractionEngine/Fact.cs index 88da4b859c93dd7d67b171d5c4d1c2c142856163..d2da5cbc0c811dc6eb87791b2f479534d69874f7 100644 --- a/Assets/InteractionEngine/Fact.cs +++ b/Assets/InteractionEngine/Fact.cs @@ -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; diff --git a/Assets/InventoryStuff/ScrollDetails.cs b/Assets/InventoryStuff/ScrollDetails.cs index 78fd19ceafc116c42f32fa39234f78cf57b4005a..12dca2d2a14d6970b70bb62c9bc9c919c3a0bf83 100644 --- a/Assets/InventoryStuff/ScrollDetails.cs +++ b/Assets/InventoryStuff/ScrollDetails.cs @@ -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>(); diff --git a/Assets/InventoryStuff/Items/scripts.meta b/Assets/Scenes.meta similarity index 77% rename from Assets/InventoryStuff/Items/scripts.meta rename to Assets/Scenes.meta index 7add7d739dd50a2eca80bb699adb3d4eab15ff6d..157e8818897d6ed29501f87f879801a120255f46 100644 --- a/Assets/InventoryStuff/Items/scripts.meta +++ b/Assets/Scenes.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: df10919d3230595438beac5071d21387 +guid: ac72be71662640f4ab0aaf102090fb95 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/README.md b/README.md index c1b1fe19a15e2859f898ec3ccf7524b7b4345825..56e82b55284fe528a6e085133b955a56ee1559dd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # 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