using System; using GP = Science.Physics.GeneralPhysics; namespace ScienceTest.PhysicsTest.GeneralPhysicsTest { /// /// MomentOfInertiaTest /// public class MomentOfInertiaTest { public MomentOfInertiaTest() { } private string result; public string Result { get{return result;} } public void Compute() { GP.Scalar.FunctionOfPosition func = new GP.Scalar.FunctionOfPosition(cd); GP.Density rho = new GP.Density(); rho.ScalarFunctionOfPosition = func; GP.Volume v = new GP.Volume(); v.XTo = 2.0; v.XFrom = -2.0; v.YTo = 2.0; v.YFrom = -2.0; v.ZTo = 2.0; v.ZFrom = -2.0; GP.MomentOfInertia I = new GP.MomentOfInertia(rho,v); result += I.ToString(); } private GP.Scalar cd(GP.Position r) { GP.Scalar s = new GP.Scalar(); if (r.X * r.X + r.Y * r.Y + r.Z * r.Z <= 1.0) s.Magnitude = 1.0; else s.Magnitude = 0.0; return s; } } } /* 1.67760671831029 +/- 0.00122844457088935 +0.00015023240134699 +/- 0.000410580249933138 -0.000243315213523889 +/- 0.000407780973046457 0.00015023240134699 +/- 0.000410580249933138 +1.67542069920362 +/- 0.00133576546256272 +5.89978456874704E-06 +/- 0.000402548823469666 -0.000243315213523889 +/- 0.000407780973046457 +5.89978456874704E-06 +/- 0.000402548823469666 +1.67574660398657 +/- 0.00134067789931897 (kgm^2) */