diff --git a/Assets/Resources/Prefabs/Facts/Cylinder.prefab b/Assets/Resources/Prefabs/Facts/Cylinder.prefab new file mode 100644 index 0000000000000000000000000000000000000000..7d8a6c1da00c38796c877a16fd67a1cc5dcaf923 --- /dev/null +++ b/Assets/Resources/Prefabs/Facts/Cylinder.prefab @@ -0,0 +1,344 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6069774532129100082 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6247848413542547290} + - component: {fileID: 2803381884781347863} + - component: {fileID: 6081132167704541829} + - component: {fileID: 6530428533264499097} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6247848413542547290 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6069774532129100082} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.19499995} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3390467403729316765} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2803381884781347863 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6069774532129100082} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6081132167704541829 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6069774532129100082} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!136 &6530428533264499097 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6069774532129100082} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.5000001 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} +--- !u!1 &6839596689016440457 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3390467403729316765} + - component: {fileID: 6950663371922587874} + m_Layer: 15 + m_Name: Cylinder + m_TagString: Selectable + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3390467403729316765 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6839596689016440457} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 6662482376097614856} + - {fileID: 6247848413542547290} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6950663371922587874 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6839596689016440457} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} + m_Name: + m_EditorClassIdentifier: + _URI: + FactText: + - {fileID: 7177577245137766670} + StringLabelFormats: [] + Default: {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2} + Selected: {fileID: 2100000, guid: 34a95baef388bb8458c97a626b732f9f, type: 2} + Hint: {fileID: 2100000, guid: 8621b710d7d1d5041bc6bfd0cc37cdff, type: 2} + Solution: {fileID: 2100000, guid: 2a003f0807acc1142965bb21bdc824f6, type: 2} + renderer: + - {fileID: 6081132167704541829} +--- !u!1 &8645286316326201467 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6662482376097614856} + - component: {fileID: 5986843358289336505} + - component: {fileID: 7177577245137766670} + - component: {fileID: 2586578973517344970} + m_Layer: 10 + m_Name: LabelText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6662482376097614856 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645286316326201467} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.4} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3390467403729316765} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 0.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!23 &5986843358289336505 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645286316326201467} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &7177577245137766670 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645286316326201467} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Test + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 4 + m_fontSizeBase: 4 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 0 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 1 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + _SortingLayer: 0 + _SortingLayerID: 0 + _SortingOrder: 0 + m_hasFontAssetChanged: 0 + m_renderer: {fileID: 5986843358289336505} + m_maskType: 0 +--- !u!114 &2586578973517344970 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8645286316326201467} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8cf5a358dacd3b54ab093ee289dd9ba2, type: 3} + m_Name: + m_EditorClassIdentifier: + Cam1: {fileID: 0} + Cam2: {fileID: 0} + BackUPCam: {fileID: 0} diff --git a/Assets/Resources/Prefabs/Facts/Cylinder.prefab.meta b/Assets/Resources/Prefabs/Facts/Cylinder.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..f6dcda2c8d37de0cc657c62040cb2ef20c6ab0ef --- /dev/null +++ b/Assets/Resources/Prefabs/Facts/Cylinder.prefab.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +<<<<<<<< HEAD:Assets/Resources/Prefabs/Facts/Square.prefab.meta +guid: 33aea09fa1ea1fa40a3eb47c47ba7650 +PrefabImporter: +======== +guid: ffa3cc5a8ea56dc4b8c5e907de1f715a +DefaultImporter: +>>>>>>>> master:Assets/StreamingAssets/StreamToPersistentDataPath/Config/Network_Backup_withAuto.JSON.meta + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs new file mode 100644 index 0000000000000000000000000000000000000000..50765db99c8231949a6e467b5435501c13dd09c2 --- /dev/null +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs @@ -0,0 +1,149 @@ +using Newtonsoft.Json; +using REST_JSON_API; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +/// <summary> +/// Point in 3D Space +/// </summary> +public class CylinderFact : FactWrappedCRTP<CylinderFact> +{ + + + //used points + public string PidM, PidE, PidT; + public Vector3 M, E, T; + public float Volume = 0.0F; + + + public PointFact GetM {get => (PointFact)FactRecorder.AllFacts[PidM];} + public PointFact GetE {get => (PointFact)FactRecorder.AllFacts[PidE];} + public PointFact GetT {get => (PointFact)FactRecorder.AllFacts[PidT];} + + protected void calculate_vectors(){ + + M = ((PointFact)FactRecorder.AllFacts[PidM]).Point + Vector3.zero; + E = ((PointFact)FactRecorder.AllFacts[PidE]).Point + Vector3.zero; + T = ((PointFact)FactRecorder.AllFacts[PidT]).Point + Vector3.zero; + //Rotation = Quaternion.LookRotation(forward, new Vector3(1.0F, 0.0F, 0.0F)); + + Position = M; + + + } + + public CylinderFact() : base(){ + this.PidM = null; + this.PidE = null; + this.PidT = null; + } + [JsonConstructor] + public CylinderFact( string PidM, string PidE, string PidT) : base() + { + this.PidM = PidM; + this.PidE = PidE; + this.PidT = PidT; + + calculate_vectors(); + } + + /// <summary> + /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. + /// <see cref="Normal"/> set to <c>Vector3.up</c> + /// </summary> + /// <param name="Point">sets <see cref="Point"/></param> + /// <param name="ServerDefinition">MMT URI as OMS</param> + public CylinderFact(string PidM, string PidE, string PidT, SOMDoc ServerDefinition) : base() + { + this.PidM = PidM; + this.PidE = PidE; + this.PidT = PidT; + + this.ServerDefinition = ServerDefinition; + + calculate_vectors(); + } + + /// \copydoc Fact.parseFact(ScrollFact) + public new static IEnumerator parseFact(List<Fact> ret, MMTFact fact) + { + if (((MMTGeneralFact)fact).defines is not OMA df) + yield break; + + OMS pointM, pointE, pointT; + + pointM = (OMS)df.arguments[0]; + pointE = (OMS)df.arguments[1]; + pointT = (OMS)df.arguments[2]; + + string PidM = pointM.uri; + string PidE = pointE.uri; + string PidT = pointT.uri; + + + + ret.Add(new CylinderFact(PidM, PidE, PidT)); + + //ParsingDictionary.parseTermsToId.TryAdd(defines.ToString(), fact.@ref.uri); + //ret.Add(new PointFact(SOMDoc.MakeVector3(defines), fact.@ref)); + } + + + /// \copydoc Fact.hasDependentFacts + public override bool HasDependentFacts => true; + + /// \copydoc Fact.getDependentFactIds + protected override string[] GetDependentFactIds() + => new string[] { PidM, PidE, PidT}; + + /// \copydoc Fact.GetHashCode + /* public override int GetHashCode() + => this.Point.GetHashCode(); + */ + protected override void RecalculateTransform() + { + calculate_vectors(); + } + /// \copydoc Fact.Equivalent(Fact, Fact) + protected override bool EquivalentWrapped(CylinderFact f1, CylinderFact f2){ + + return ( + + Math3d.IsApproximatelyEqual(f1.M, f2.M) + && Math3d.IsApproximatelyEqual(f1.E, f2.E) + && Math3d.IsApproximatelyEqual(f1.T, f2.T) + + ); + + } + + public bool isEqual(CylinderFact f2){ + return EquivalentWrapped(this, f2); + } + + protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new){ + + return new CylinderFact(this.PidM, this.PidE, this.PidT); + + } + + public override MMTFact MakeMMTDeclaration() + { + SOMDoc tp = new OMS(MMTConstants.CylinderType); + + return new MMTGeneralFact(_LastLabel, tp, Defines()); + } + + public override SOMDoc Defines() + => new OMA( + new OMS(MMTConstants.CylinderCons), + new[] { + new OMS(PidM), + new OMS(PidE), + new OMS(PidT), + } + ); +} \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs.meta b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..65aae483078422cabb8912494c2a4fc599706d24 --- /dev/null +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CylinderFact.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d78a8f0726bf984409e3ad4f0b2e126f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index c818c51f29bc6377defd62c7fc5d39af5cac02d1..e579412cfe8e91e831da79b85fcc182d35dc8829 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -95,6 +95,10 @@ public static class ParsingDictionary MMTConstants.PrismType, PrismFact.parseFact }, + { + MMTConstants.CylinderType, + CylinderFact.parseFact + } }; // TODO: get rid of this @@ -141,6 +145,7 @@ public static class ParsingDictionary [JsonSubtypes.KnownSubType(typeof(SphereFact), nameof(SphereFact))] [JsonSubtypes.KnownSubType(typeof(CuboidFact), nameof(CuboidFact))] [JsonSubtypes.KnownSubType(typeof(PrismFact), nameof(PrismFact))] +[JsonSubtypes.KnownSubType(typeof(CylinderFact), nameof(CylinderFact))] public abstract class Fact { [JsonIgnore] diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs index 54d2d7d4cdfcacf1f56c05864388beea513852dd..8a5ab7194e52b1d91d183e2192d5efcc1fcb945d 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs @@ -64,6 +64,10 @@ public static class MMTConstants public static readonly string SphereType = "http://mathhub.info/FrameIT/frameworld?SphereType?sphereType"; public static readonly string SphereScroll = "http://mathhub.info/FrameIT/frameworld?SphereScroll"; + public static readonly string CylinderCons = "http://mathhub.info/FrameIT/frameworld?CylinderType?cylinderCons"; + public static readonly string CylinderType = "http://mathhub.info/FrameIT/frameworld?CylinderType?cylinderType"; + public static readonly string CylinderScroll = "http://mathhub.info/FrameIT/frameworld?CylinderScroll"; + public static readonly string CircleType3d = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?circleType3D"; public static readonly string MkCircle3d = "http://mathhub.info/FrameIT/frameworld?FrameITCircle?circle3D"; public static readonly string TriangleMiddlePoint = "http://mathhub.info/FrameIT/frameworld?FrameITTriangles?triangleMidPointWrapper";