Browse Source

Some code improvements, and new radius formula.

master
Nikita Romanenko 6 years ago
parent
commit
b45fbecdeb
  1. 10
      Pores/Models/Localizations/NormalLocalization.cs
  2. 2
      Pores/Models/Point.cs
  3. 7
      Pores/Models/Point2D.cs
  4. 7
      Pores/Models/Point3D.cs

10
Pores/Models/Localizations/NormalLocalization.cs

@ -27,7 +27,7 @@ namespace Pores.Models.Localizations
public override ObservableCollection<Pore> GetLocalization() public override ObservableCollection<Pore> GetLocalization()
{ {
var r = new Random(); var r = new Random();
maxR = Math.Sqrt(Material.NumberOfPores / (Material.Height * Material.Width * Material.Depth) / 3.14); GetMaxRadius();
var result = new ObservableCollection<Pore>(); var result = new ObservableCollection<Pore>();
for (int i = 0; i <= Material.NumberOfPores; i++) for (int i = 0; i <= Material.NumberOfPores; i++)
for (int j = 0; j <= Material.NumberOfPores; j++) for (int j = 0; j <= Material.NumberOfPores; j++)
@ -47,12 +47,18 @@ namespace Pores.Models.Localizations
return result; return result;
} }
private void GetMaxRadius()
{
var m = Material;
var volume = m.Height * m.Width * m.Depth;
maxR = Math.Round(Math.Pow((3.0 / 4.0) * volume / (3.14 * Math.Pow(m.NumberOfPores, 3)), 1.0 / 3.0), 3);
}
public NormalLocalization(Material material) public NormalLocalization(Material material)
{ {
Material = material; Material = material;
sigma = 4; sigma = 4;
mu = Material.Height - Material.Height / 4; mu = Material.Height - Material.Height / 4;
} }
} }
} }

2
Pores/Models/Point.cs

@ -4,6 +4,6 @@ namespace Pores.Models
{ {
public class Point : PropertyChangedClass public class Point : PropertyChangedClass
{ {
public double X { get; set; } public virtual double X { get; set; }
} }
} }

7
Pores/Models/Point2D.cs

@ -1,7 +1,10 @@
namespace Pores.Models using Pores.Helpers;
namespace Pores.Models
{ {
public class Point2D : Point public class Point2D : Point
{ {
public double Y { get; set; } public override double X { get; set; }
public virtual double Y { get; set; }
} }
} }

7
Pores/Models/Point3D.cs

@ -1,4 +1,5 @@
using System; using Pores.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Pores.Models namespace Pores.Models
@ -6,7 +7,9 @@ namespace Pores.Models
[Serializable] [Serializable]
public class Point3D : Point2D public class Point3D : Point2D
{ {
public double Z { get; set; } public override double X { get; set; }
public override double Y { get; set; }
public virtual double Z { get; set; }
public List<double> ToList() public List<double> ToList()
{ {

Loading…
Cancel
Save