Newer
Older
/// <param name="radius"> <see cref="radius"/></param>
/// <returns>struct for <see cref="AddFactResponse"/></returns>
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
List<SOMDoc> outerArguments = new List<SOMDoc>
//CirclePlane,
new OMA(
//PointNormalPlane,
MaZiFAU
committed
new OMS(MMT_OMS_URI.pointNormalPlane),
MaZiFAU
committed
new List<SOMDoc> {
//base point of the circle plane?,
//NormalVector,
new OMA(
//"Vector"
MaZiFAU
committed
new OMS(MMT_OMS_URI.Tuple),
MaZiFAU
committed
new List<SOMDoc> {
new OMF(normal.x),
new OMF(normal.y),
new OMF(normal.z)
}
),
}
),
//middlePoint,
};
// Do i need this here? doubt
MaZiFAU
committed
SOMDoc tp = new OMS(MMT_OMS_URI.CircleType3d);
SOMDoc df = new OMA(new OMS(MMT_OMS_URI.MkCircle3d), outerArguments);
return new MMTSymbolDeclaration(Label, tp, df);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Pid1, Pid2 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(CircleFact f1, CircleFact f2)
=> DependentFactsEquivalent(f1, f2)
&& Math3d.IsApproximatelyEqual(f1.normal, f2.normal)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new CircleFact(old_to_new[this.Pid1], old_to_new[this.Pid2], this.radius, this.normal, organizer);
}
/// <summary>
/// A <see cref="PointFact"/> on a <see cref="CircleFact"/>
/// </summary>
public class OnCircleFact : FactWrappedCRTP<OnCircleFact>
{
/// <summary> the point on the circle </summary>
public string Pid;
/// <summary> the circle, which the point is on </summary>
public string Cid;
MaZiFAU
committed
[JsonIgnore]
public PointFact Point { get => (PointFact)FactOrganizer.AllFacts[Pid]; }
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid]; }
MaZiFAU
committed
/// <summary> \copydoc Fact.Fact </summary>
public OnCircleFact() : base()
{
this.Pid = null;
this.Cid = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates <see cref="Pid"/>, <see cref="Rid"/>, <see cref="Fact._URI"/> and creates MMT %Fact Server-Side
/// </summary>
/// <param name="pid">sets <see cref="Pid"/></param>
/// <param name="cid">sets <see cref="Cid"/></param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public OnCircleFact(string pid, string cid, FactOrganizer organizer) : base(organizer)
{
this.Pid = pid;
{
Position = Point.Position;
Rotation = Circle.Rotation;
}
/// <summary>
/// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_.
/// </summary>
/// <param name="pid">sets <see cref="Pid"/></param>
/// <param name="cid">sets <see cref="Cid"/></param>
/// <param name="uri">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public OnCircleFact(string pid, string cid, string uri, FactOrganizer organizer) : base(organizer)
{
this.Pid = pid;
this.Cid = cid;
this._URI = uri;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static OnCircleFact parseFact(MMTDeclaration fact)
if (((MMTSymbolDeclaration)fact).type is not OMA type)
string circleUri = ((OMS)((OMA)type.arguments[0]).arguments[0]).uri;
string pointUri = ((OMS)((OMA)type.arguments[0]).arguments[1]).uri;
if (!FactOrganizer.AllFacts.ContainsKey(pointUri)
|| !FactOrganizer.AllFacts.ContainsKey(circleUri))
return new OnCircleFact(pointUri, circleUri, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Pid, Cid };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(OnCircleFact c1, OnCircleFact c2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new OnCircleFact(old_to_new[this.Pid], old_to_new[this.Cid], organizer);
public override MMTDeclaration MakeMMTDeclaration()
{
SOMDoc tp =
new OMA(
new OMS(MMT_OMS_URI.Ded),
new List<SOMDoc> {
new OMA(
new OMS(MMT_OMS_URI.OnCircle),
new List<SOMDoc> {
new OMS(Cid),
new OMS(Pid),
}),});
SOMDoc df = null;
return new MMTSymbolDeclaration(Label, tp, df);
}
}
/// <summary>
/// Angle comprised of a line and a circle
/// </summary>
public class AngleCircleLineFact : FactWrappedCRTP<AngleCircleLineFact>
{
/// @{ <summary>
/// One <see cref="Fact.Id">Id</see> of a <see cref="RayFact">RayFact</see> and a <see cref="CircleFact">CircleFact</see> defining Angle [<see cref="Cid1"/>, <see cref="Rid2"/>].
/// </summary>
public string Cid1, Rid2;
/// @}
MaZiFAU
committed
[JsonIgnore]
public AbstractLineFact Ray { get => (AbstractLineFact)FactOrganizer.AllFacts[Rid2]; }
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> \copydoc Fact.Fact </summary>
public AngleCircleLineFact() : base()
{
this.Cid1 = null;
this.Rid2 = null;
this.angle = 0.0f;
}
/// <summary>
/// Standard Constructor:
/// Initiates <see cref="Cid1"/>, <see cref="Rid2"/>, <see cref="angle"/> <see cref="Fact._URI"/> and creates MMT %Fact Server-Side
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="rid2">sets <see cref="Rid2"/></param>
/// <param name="angle"> sets the angle </param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public AngleCircleLineFact(string cid1, string rid2, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Rid2 = rid2;
this.angle = Math3d.AngleVectorPlane(Ray.Dir, Circle.normal).ToDegrees();
Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position);
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
Position = intersection;
{ //Rotation
Vector3 from = (Circle.Position - Position).normalized;
Vector3 angle_to = Math3d.IsApproximatelyEqual(intersection, Ray.Point1.Position)
? Ray.Point2.Position
: Ray.Point1.Position;
Vector3 to = (angle_to - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forwoard = (from + to).normalized;
if (up.sqrMagnitude < Math3d.vectorPrecission)
{ //Angle is 180° (or 0°)
Vector3 arbitary = up.normalized == Vector3.forward ? Vector3.right : Vector3.forward;
up = Vector3.Cross(arbitary, to);
forwoard = Vector3.Cross(up, to);
}
Rotation = Quaternion.LookRotation(forwoard, up);
}
}
/// <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="´Rid2">sets <see cref="Rid2"/></param>
/// <param name="angle"> sets the angle </param>
/// <param name="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public AngleCircleLineFact(string Cid1, string Rid2, float angle, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Rid2 = Rid2;
this.angle = angle;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static AngleCircleLineFact parseFact(MMTDeclaration fact)
return null;
// init it with 0 degrees, so we don't accidentally generate orthogonalfacts
// and the parsing works correctly if smb ever adds a scroll for this
float angle = 0.0f;
if (((MMTValueDeclaration)fact).value is OMF oMFangle)
angle = oMFangle.@float;
string CircleUri = ((OMS)lhs.arguments[0]).uri;
string RayUri = ((OMS)lhs.arguments[1]).uri;
if (!FactOrganizer.AllFacts.ContainsKey(CircleUri)
|| !FactOrganizer.AllFacts.ContainsKey(RayUri))
return null;
return new AngleCircleLineFact(CircleUri, RayUri, angle, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.AnglePlaneLine),
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Rid2),
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Cid1, Rid2 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(AngleCircleLineFact f1, AngleCircleLineFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new AngleCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Rid2], organizer);
}
/// <summary>
/// A RadiusFact that corresponds to a <see cref="CircleFact">PointFacts</see> and has a float value (the actual radius).
/// </summary>
public class RadiusFact : FactWrappedCRTP<RadiusFact>
{
/// <summary> The circle corresponding to the radius </summary>
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> The radius as a float </summary>
public float rad;
/// <summary> \copydoc Fact.Fact </summary>
public RadiusFact() : base()
{
this.Cid1 = null;
this.rad = 0.0f;
}
/// <summary>
/// Standard Constructor:
/// Initiates <see cref="Cid1"/> and <see cref="rad"/>
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public RadiusFact(string cid1, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
{
Position = Circle.Position;
Rotation = Circle.Rotation;
}
/// <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="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public RadiusFact(string Cid1, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static RadiusFact parseFact(MMTDeclaration fact)
string CircleUri = ((OMS)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).uri;
return new RadiusFact(CircleUri, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
/// <summary>
/// Constructs struct for not-right-angled MMT %Fact <see cref="AddFactResponse"/>
/// </summary>
/// <param name="rad"> see <see cref="rad"/></param>
/// <param name="c1URI"> see <see cref="Cid1"/></param>
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.RadiusCircleMetric),
new List<SOMDoc> {
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
SOMDoc value = new OMF(rad);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Cid1 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(RadiusFact f1, RadiusFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new RadiusFact(old_to_new[this.Cid1], organizer);
}
/// <summary>
/// Area of a <see cref="CircleFact">CircleFact</see>
/// </summary>
public class AreaCircleFact : FactWrappedCRTP<AreaCircleFact>
{
/// <summary> the circle <see cref="CircleFact">CircleFact</see> </summary>
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> the area which is contained by the circle </summary>
public float A;
/// <summary> \copydoc Fact.Fact </summary>
public AreaCircleFact() : base()
{
this.Cid1 = null;
this.A = 0.0f;
}
/// <summary>
/// Standard Constructor:
/// Initiates <see cref="Cid1"/> and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public AreaCircleFact(string cid1, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.A = Circle.radius * Circle.radius * ((float)System.Math.PI);
{
Position = Circle.Position;
Rotation = Circle.Rotation;
}
/// <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="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public AreaCircleFact(string Cid1, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static AreaCircleFact parseFact(MMTDeclaration fact)
string CircleUri = ((OMS)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).uri;
return new AreaCircleFact(CircleUri, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.AreaCircle),
new List<SOMDoc> {
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Cid1 };
/// \copydoc Fact.GetHashCode
public override int GetHashCode()
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(AreaCircleFact f1, AreaCircleFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new AreaCircleFact(old_to_new[this.Cid1], organizer);
}
/// <summary>
/// The volume of a cone A defined by a base area <see cref="CircleFact">CircleFact</see>, an apex <see cref="PointFact">PointFact</see> and the volume as float
/// </summary>
public class ConeVolumeFact : FactWrappedCRTP<ConeVolumeFact>
{
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary>
public string Cid1;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> a <see cref="PointFact">PointFact</see> describing the apex point </summary>
public string Pid1;
MaZiFAU
committed
[JsonIgnore]
public PointFact Point { get => (PointFact)FactOrganizer.AllFacts[Pid1]; }
MaZiFAU
committed
/// <summary> the volume of the cone as a float </summary>
public float vol;
/// <summary> \copydoc Fact.Fact </summary>
public ConeVolumeFact() : base()
{
this.Cid1 = null;
this.Pid1 = null;
this.vol = 0.0f;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="pid1">sets <see cref="Pid1"/></param>
/// <param name="vol">sets <see cref="vol"/></param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public ConeVolumeFact(string cid1, string pid1, float vol, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Pid1 = pid1;
this.vol = vol;
{
Position = Point.Position;
Rotation = Circle.Rotation;
}
/// <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="Pid1">sets <see cref="Pid1"/></param>
/// <param name="volume">sets <see cref="vol"/></param>
/// <param name="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public ConeVolumeFact(string Cid1, string Pid1, float volume, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Pid1 = Pid1;
this.vol = volume;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static ConeVolumeFact parseFact(MMTDeclaration fact)
string CircleUri = ((OMS)((OMA)lhs.arguments[0]).arguments[0]).uri;
string PointUri = ((OMS)((OMA)lhs.arguments[0]).arguments[1]).uri;
float volume = 0.0f;
if (((MMTValueDeclaration)fact).value is OMF oMFvolume)
volume = oMFvolume.@float;
if (!FactOrganizer.AllFacts.ContainsKey(CircleUri)
|| !FactOrganizer.AllFacts.ContainsKey(PointUri))
return new ConeVolumeFact(CircleUri, PointUri, volume, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.VolumeCone),
MaZiFAU
committed
new List<SOMDoc> {
new OMA(new OMS(MMT_OMS_URI.ConeOfCircleApex),
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Pid1),
}
),
}
);
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
MaZiFAU
committed
protected override string[] GetGetDependentFactIds()
=> new string[] { Cid1, Pid1 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(ConeVolumeFact f1, ConeVolumeFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new ConeVolumeFact(old_to_new[this.Cid1], old_to_new[this.Pid1], this.vol, organizer);
}
/// <summary>
/// The fact that the plane of a <see cref="CircleFact">CircleFact</see> and the line <see cref="RayFact>RayFact</see> are orthogonal
/// </summary>
public class OrthogonalCircleLineFact : FactWrappedCRTP<OrthogonalCircleLineFact>
{
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary>
public string Cid1;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> a <see cref="RayFact">Rayfact</see> describing the line </summary>
public string Lid1;
MaZiFAU
committed
[JsonIgnore]
public AbstractLineFact Ray { get => (AbstractLineFact)FactOrganizer.AllFacts[Lid1]; }
//TODO? deg or rad?
[JsonIgnore]
public float angle = 90f;
[JsonIgnore]
public Vector3 intersection;
/// <summary> \copydoc Fact.Fact </summary>
public OrthogonalCircleLineFact() : base()
{
this.Cid1 = null;
this.Lid1 = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </summary>
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="lid1">sets <see cref="Lid1"/></param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public OrthogonalCircleLineFact(string cid1, string lid1, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Lid1 = lid1;
Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position);
Position = intersection;
{ //Rotation
Vector3 from = (Circle.Position - Position).normalized;
Vector3 angle_to = Math3d.IsApproximatelyEqual(intersection, Ray.Point1.Position)
? Ray.Point2.Position
: Ray.Point1.Position;
Vector3 to = (angle_to - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forward = (from + to).normalized;
Rotation = Quaternion.LookRotation(forward, up);
}
}
/// <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="Lid1">sets <see cref="Lid1"/></param>
/// <param name="backendURI">MMT URI</param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public OrthogonalCircleLineFact(string Cid1, string Lid1, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Lid1 = Lid1;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static OrthogonalCircleLineFact parseFact(MMTDeclaration fact)
if (((MMTSymbolDeclaration)fact).type is not OMA type)
string CircleUri = ((OMS)((OMA)type.arguments[0]).arguments[0]).uri;
string LineUri = ((OMS)((OMA)type.arguments[0]).arguments[1]).uri;
if (!FactOrganizer.AllFacts.ContainsKey(CircleUri)
|| !FactOrganizer.AllFacts.ContainsKey(LineUri))
return new OrthogonalCircleLineFact(CircleUri, LineUri, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc tp = new OMA(
MaZiFAU
committed
new List<SOMDoc>{
new OMS(MMT_OMS_URI.OrthoCircleLine),
MaZiFAU
committed
new List<SOMDoc>{
new OMS(Cid1),
new OMS(Lid1),
MaZiFAU
committed
SOMDoc df = null;
return new MMTSymbolDeclaration(this.Label, tp, df);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Cid1, Lid1 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(OrthogonalCircleLineFact f1, OrthogonalCircleLineFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new OrthogonalCircleLineFact(old_to_new[this.Cid1], old_to_new[this.Lid1], organizer);
}
/// <summary>
/// The volume of a cone A 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 TruncatedConeVolumeFact : FactWrappedCRTP<TruncatedConeVolumeFact>
{
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the base area </summary>
public string Cid1;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle1 { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the top area </summary>
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle2 { get => (CircleFact)FactOrganizer.AllFacts[Cid2]; }
MaZiFAU
committed
/// <summary> the volume of Truncated the cone as a float </summary>
/// <summary> a proof that both circles have not the same size </summary>
public string unequalCirclesProof;
/// <summary> OMA proof that the two circles are parallel </summary>
public OMA proof;
/// <summary> \copydoc Fact.Fact </summary>
public TruncatedConeVolumeFact() : base()
{
this.Cid1 = null;
this.Cid2 = null;
this.vol = 0.0f;
this.unequalCirclesProof = null;
this.proof = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </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 TruncatedConeVolumeFact(string cid1, string cid2, float vol, string unequalproof, OMA proof, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
this.proof = proof;
this.unequalCirclesProof = unequalproof;
{
Position = Circle2.Position;
Rotation = Circle2.Rotation;
}
/// <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 TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string unequalproof, OMA proof, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;
this.Cid2 = Cid2;
this.vol = volume;
this.proof = proof;
this.unequalCirclesProof = unequalproof;
this._URI = backendURI;
_ = this.Label;
}
/// \copydoc Fact.parseFact(ScrollFact)
public new static TruncatedConeVolumeFact parseFact(MMTDeclaration fact)
string Circle1Uri = ((OMS)((OMA)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).arguments[0]).uri;
string Circle2Uri = ((OMS)((OMA)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).arguments[1]).uri;
float volume = ((OMF)((MMTValueDeclaration)fact).value).@float;
string UnEqualCirclesProof = ((OMS)(((OMA)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).arguments[2])).uri;
OMA proof = (OMA)(((OMA)((OMA)((MMTValueDeclaration)fact).lhs).arguments[0]).arguments[3]);
if (!FactOrganizer.AllFacts.ContainsKey(Circle1Uri)
|| !FactOrganizer.AllFacts.ContainsKey(Circle2Uri))
return new TruncatedConeVolumeFact(Circle1Uri, Circle2Uri, volume, UnEqualCirclesProof, proof, fact.@ref.uri, StageStatic.stage.factState);
}
/// \copydoc Fact.generateLabel
protected override string generateLabel()
public override MMTDeclaration MakeMMTDeclaration()
MaZiFAU
committed
SOMDoc lhs =
MaZiFAU
committed
new OMS(MMT_OMS_URI.TruncatedVolumeCone),
new List<SOMDoc> {
new OMS(Cid1),
new OMS(Cid2),
new OMS(unequalCirclesProof),
proof,
}
);
MaZiFAU
committed
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
return new MMTValueDeclaration(this.Label, lhs, valueTp, value);
}
/// \copydoc Fact.hasDependentFacts
MaZiFAU
committed
public override bool HasDependentFacts => true;
/// \copydoc Fact.getDependentFactIds
=> new string[] { Cid1, Cid2 };
/// \copydoc Fact.Equivalent(Fact, Fact)
protected override bool EquivalentWrapped(TruncatedConeVolumeFact f1, TruncatedConeVolumeFact f2)
protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new, FactOrganizer organizer)
=> new TruncatedConeVolumeFact(old_to_new[this.Cid1], old_to_new[this.Cid2], this.vol, old_to_new[this.unequalCirclesProof], this.proof, organizer);
/// <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;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle1 { get => (CircleFact)FactOrganizer.AllFacts[Cid1]; }
MaZiFAU
committed
/// <summary> a <see cref="CircleFact">CircleFact</see> describing the top area </summary>
public string Cid2;
MaZiFAU
committed
[JsonIgnore]
public CircleFact Circle2 { get => (CircleFact)FactOrganizer.AllFacts[Cid2]; }
MaZiFAU
committed
/// <summary> the volume of the cylinder as a float </summary>
public float vol;
/// <summary> a proof that both circles have the same size </summary>
public string equalCirclesProof;
/// <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;
this.equalCirclesProof = null;
}
/// <summary>
/// Standard Constructor:
/// Initiates members and creates MMT %Fact Server-Side
/// </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, string eqProof, OMA proof, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = cid1;
this.Cid2 = cid2;
this.proof = proof;
this.equalCirclesProof = eqProof;
this.vol = vol;
{
Position = Circle2.Position;
Rotation = Circle2.Rotation;
}
/// <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, string eqProof, OMA proof, string backendURI, FactOrganizer organizer) : base(organizer)
{
this.Cid1 = Cid1;