diff --git a/Assets/Scenes/Worlds/RiverWorld.unity b/Assets/Scenes/Worlds/RiverWorld.unity index dfb871e6f54bb45ae675b5b4c3739b90aff79729..a138fa8e01a4314e74279fdd91a704600b6bb946 100644 --- a/Assets/Scenes/Worlds/RiverWorld.unity +++ b/Assets/Scenes/Worlds/RiverWorld.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.4410865, g: 0.48984045, b: 0.5699203, a: 1} + m_IndirectSpecularColor: {r: 0.4410664, g: 0.4898227, b: 0.5699191, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -57707,6 +57707,12 @@ PrefabInstance: value: objectReference: {fileID: 8156936215466465834, guid: b6f35afcaff5d8a40bf8f792eb3299e6, type: 3} + - target: {fileID: 3020720019460506146, guid: b07552db700124a4680401e6fb94c186, + type: 3} + propertyPath: prefab_CylinderVolume + value: + objectReference: {fileID: 4509982228914264782, guid: 09974a8b56c29434a9c32f1adc92d705, + type: 3} - target: {fileID: 3020720019460506146, guid: b07552db700124a4680401e6fb94c186, type: 3} propertyPath: prefab_AngleCircleLineFact diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs index 74a09191171cd89d111ec38dc6da0dfeca09201b..854776b10165907f9164afcbca553e5522ea3c89 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs @@ -32,7 +32,8 @@ public class ParsingDictionary { {MMTURIs.OrthoCircleLine, OrthogonalCircleLineFact.parseFact }, {MMTURIs.VolumeCone ,ConeVolumeFact.parseFact }, {MMTURIs.TruncatedVolumeCone ,TruncatedConeVolumeFact.parseFact }, - {MMTURIs.RightAngle, RightAngleFact.parseFact } + {MMTURIs.RightAngle, RightAngleFact.parseFact }, + {MMTURIs.CylinderVolume, CylinderVolumeFact.parseFact } @@ -3331,3 +3332,202 @@ protected override bool EquivalentWrapped(RightAngleFact f1, RightAngleFact f2) } + + +/// <summary> +/// The volume of a cylinder defined by a base area <see cref="CircleFact">CircleFact</see>, a top area <see cref="CircleFact">CircleFact</see> and the volume as float +/// </summary> +public class CylinderVolumeFact : FactWrappedCRTP<CylinderVolumeFact> +{ + /// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary> + public string Cid1; + /// <summary> a <see cref="CircleFact">CircleFact</see> describing the top area </summary> + public string Cid2; + /// <summary> the volume of the cylinder as a float </summary> + public float vol; + /// <summary> OMA proof that the two circles are parallel </summary> + public OMA proof; + + /// <summary> \copydoc Fact.Fact </summary> + public CylinderVolumeFact() : base() + { + this.Cid1 = null; + this.Cid2 = null; + this.vol = 0.0f; + this.proof = null; + + } + + /// <summary> + /// Copies <paramref name="fact"/> by initiating new MMT %Fact. + /// </summary> + /// <param name="fact">Fact to be copied</param> + /// <param name="old_to_new"><c>Dictionary</c> mapping <paramref name="fact"/>.<see cref="getDependentFactIds"/> in <paramref name="fact"/>.<see cref="Fact._Facts"/> to corresponding <see cref="Fact.Id"/> in <paramref name="organizer"/> </param> + /// <param name="organizer">sets <see cref="_Facts"/></param> + public CylinderVolumeFact(CylinderVolumeFact fact, Dictionary<string, string> old_to_new, FactOrganizer organizer) : base(fact, organizer) + { + init(old_to_new[fact.Cid1], old_to_new[fact.Cid2], fact.vol, fact.proof); + } + + /// <summary> + /// Standard Constructor + /// </summary> + /// <param name="cid1">sets <see cref="Cid1"/></param> + /// <param name="cid2">sets <see cref="Cid2"/></param> + /// <param name="vol">sets <see cref="vol"/></param> + /// <param name="proof">sets <see cref="proof"/></param> + /// <param name="organizer">sets <see cref="Fact._Facts"/></param> + public CylinderVolumeFact(string cid1, string cid2, float vol, OMA proof, FactOrganizer organizer) : base(organizer) + { + init(cid1, cid2, vol, proof); + } + + /// <summary> + /// sets variables and generates MMT Declaration + /// </summary> + /// <param name="cid1">sets <see cref="Cid1"/></param> + /// <param name="cid2">sets <see cref="Cid2"/></param> + /// <param name="vol">sets <see cref="vol"/></param> + /// <param name="proof">sets <see cref="proof"/></param> + private void init(string cid1, string cid2, float vol, OMA proof) + { + this.Cid1 = cid1; + this.Cid2 = cid2; + this.proof = proof; + + CircleFact cf1 = _Facts[cid1] as CircleFact; + CircleFact cf2 = _Facts[cid2] as CircleFact; + this.vol = vol; + + + MMTDeclaration mmtDecl; + string c1URI = cf1.Id; + string c2URI = cf2.Id; + + + mmtDecl = generateMMTDeclaration(c1URI, c2URI, vol, proof); + + AddFactResponse.sendAdd(mmtDecl, out this._URI); + } + + /// <summary> + /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. + /// </summary> + /// <param name="Cid1">sets <see cref="Cid1"/></param> + /// <param name="Cid2">sets <see cref="Cid2"/></param> + /// <param name="volume">sets <see cref="vol"/></param> + /// <param name="proof">sets <see cref="proof"/></param> + /// <param name="backendURI">MMT URI</param> + /// <param name="organizer">sets <see cref="Fact._Facts"/></param> + public CylinderVolumeFact(string Cid1, string Cid2, float volume, OMA proof, string backendURI, FactOrganizer organizer) : base(organizer) + { + this.Cid1 = Cid1; + this.Cid2 = Cid2; + this.vol = volume; + this.proof = proof; + + this._URI = backendURI; + _ = this.Label; + } + + /// \copydoc Fact.parseFact(Scroll.ScrollFact) + public new static CylinderVolumeFact parseFact(Scroll.ScrollFact fact) + { + string uri = fact.@ref.uri; + + string Circle1Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[0]).uri; + string Circle2Uri = ((OMS)((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[1]).uri; + float volume = ((OMF)((Scroll.ScrollValueFact)fact).value).f; + + OMA proof = (OMA)(((OMA)((OMA)((Scroll.ScrollValueFact)fact).lhs).arguments[0]).arguments[2]); + + if (StageStatic.stage.factState.ContainsKey(Circle1Uri) && StageStatic.stage.factState.ContainsKey(Circle2Uri)) + + return new CylinderVolumeFact(Circle1Uri, Circle2Uri, volume, proof, uri, StageStatic.stage.factState); + + else //If dependent facts do not exist return null + return null; + } + + /// \copydoc Fact.generateLabel + protected override string generateLabel() + { + return "V(" + _Facts[Cid1].Label + "," + _Facts[Cid2].Label + ")"; + } + + + + /// <summary> + /// Constructs struct for not-right-angled MMT %Fact <see cref="AddFactResponse"/> + /// </summary> + /// <param name="c1URI"> Uri for <see cref="Cid1"/></param> + /// <param name="c2URI"> Uri for <see cref="Cid2"/></param> + /// <param name="val"> <see cref="vol"/></param> + /// <returns>struct for <see cref="AddFactResponse"/></returns> + private MMTDeclaration generateMMTDeclaration(string c1URI, string c2URI, float val, OMA proof) + { + MMTTerm lhs = + new OMA( + new OMS(MMTURIs.CylinderVolume), + + new List<MMTTerm> { + new OMS(c1URI), + new OMS(c2URI), + proof, + } + ); + + MMTTerm valueTp = new OMS(MMTURIs.RealLit); + MMTTerm value = new OMF(val); + + return new MMTValueDeclaration(this.Label, lhs, valueTp, value); + } + + /// \copydoc Fact.hasDependentFacts + public override Boolean hasDependentFacts() + { + return true; + } + + /// \copydoc Fact.getDependentFactIds + public override string[] getDependentFactIds() + { + return new string[] { Cid1, Cid2 }; + } + + /// \copydoc Fact.instantiateDisplay(GameObject, Transform) + public override GameObject instantiateDisplay(GameObject prefab, Transform transform) + { + var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform); + obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = _Facts[this.Cid1].Label + _Facts[this.Cid2].Label; + obj.GetComponent<FactWrapper>().fact = this; + + return obj; + } + + /// \copydoc Fact.GetHashCode + /// uhhh is this a problem? + public override int GetHashCode() + { + return this.Cid1.GetHashCode() ^ this.Cid2.GetHashCode(); + } + + /// \copydoc Fact.Equivalent(Fact, Fact) + protected override bool EquivalentWrapped(CylinderVolumeFact f1, CylinderVolumeFact f2) + { + if (f1.Cid1 == f2.Cid1 && f1.Cid2 == f2.Cid2) + return true; + + CircleFact c1f1 = (CircleFact)_Facts[f1.Cid1]; + CircleFact c1f2 = (CircleFact)_Facts[f2.Cid1]; + + CircleFact c2f1 = (CircleFact)_Facts[f1.Cid2]; + CircleFact c2f2 = (CircleFact)_Facts[f2.Cid2]; + + return (c1f1.Equivalent(c1f2) && c2f1.Equivalent(c2f2) && f1.vol == f2.vol); + + } +} + + + diff --git a/Assets/Scripts/InventoryStuff/DisplayFacts.cs b/Assets/Scripts/InventoryStuff/DisplayFacts.cs index 392181e17b5bed3de5eb43329302eebb3a8d6403..12d5402e1c2d18fc1acb3985f490d34fcc6c551f 100644 --- a/Assets/Scripts/InventoryStuff/DisplayFacts.cs +++ b/Assets/Scripts/InventoryStuff/DisplayFacts.cs @@ -24,6 +24,7 @@ public class DisplayFacts : MonoBehaviour public GameObject prefab_OrthogonalCircleLine; public GameObject prefab_TruncatedConeVolume; public GameObject prefab_RightAngle; + public GameObject prefab_CylinderVolume; @@ -57,6 +58,7 @@ void Start() {typeof(OrthogonalCircleLineFact), prefab_OrthogonalCircleLine }, {typeof(TruncatedConeVolumeFact), prefab_TruncatedConeVolume }, {typeof(RightAngleFact), prefab_RightAngle }, + {typeof(CylinderVolumeFact), prefab_CylinderVolume}, diff --git a/Assets/Scripts/InventoryStuff/Scroll.cs b/Assets/Scripts/InventoryStuff/Scroll.cs index cb6f0d886d5f5a487fdf9e164a30aad2ed6b7a75..5a88d64621bc5683e8678bb6f4bf91e9d492a18b 100644 --- a/Assets/Scripts/InventoryStuff/Scroll.cs +++ b/Assets/Scripts/InventoryStuff/Scroll.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using static JSONManager; + public class Scroll { public string @ref; diff --git a/Assets/Scripts/JSONManager.cs b/Assets/Scripts/JSONManager.cs index 7bc712241e72019ab60075f36cf855e468db7c32..f4a848e6deb3a5e63b0f3a501fadb1c74efd38d2 100644 --- a/Assets/Scripts/JSONManager.cs +++ b/Assets/Scripts/JSONManager.cs @@ -40,12 +40,14 @@ public class MMTURICollection public string ParametrizedPlane = "http://mathhub.info/MitM/core/geometry?Geometry/Planes?ParametrizedPlane"; public string pointNormalPlane = "http://mathhub.info/MitM/core/geometry?Geometry/Planes?pointNormalPlane"; - public string OnCircle = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?pointOnCircle"; + public string OnCircle = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?pointOnCircle"; public string AnglePlaneLine = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?angleCircleLine"; - public string OrthoCircleLine = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?orthogonalCircleLine"; + public string OrthoCircleLine ="http://mathhub.info/FrameIT/frameworld?FrameITCircle?orthogonalCircleLine"; public string TruncatedVolumeCone = "http://mathhub.info/FrameIT/frameworld?FrameITCone?truncatedConeVolume"; + public string CylinderVolume = "http://mathhub.info/FrameIT/frameworld?FrameITCylinder?cylinderVolume"; + public string ParallelCircles = "http://mathhub.info/FrameIT/frameworld?FrameITCone?parallelCircles"; public string RightAngle = "http://mathhub.info/FrameIT/frameworld?FrameITBasics?rightAngle"; diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 81152c307bc638438d2d57c3a1ba2f6166d029a1..8938eb318bb43ddcedec33549da5fbd3497d84f9 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -18,10 +18,10 @@ EditorUserSettings: value: 22424703114646680e0b0227036c721518021d39631b32313f3d2e30f0e53136acf238e0f323 flags: 0 RecentlyUsedScenePath-4: - value: 22424703114646680e0b0227036c721518021d39630527392304183df7e57a2decee22f0 + value: 22424703114646680e0b0227036c681f041b1c39631a2f26283b2a3cf0ec3076f7e93ffdfe flags: 0 RecentlyUsedScenePath-5: - value: 22424703114646680e0b0227036c681f041b1c39631a2f26283b2a3cf0ec3076f7e93ffdfe + value: 22424703114646680e0b0227036c721518021d39630527392304183df7e57a2decee22f0 flags: 0 vcSharedLogLevel: value: 0d5e400f0650