Add cylinders to 3dLogic
This commit is contained in:
@@ -18,6 +18,9 @@ namespace DataAccess.DTOs
|
|||||||
public List<IForceAction> ForceActions { get; } = [];
|
public List<IForceAction> ForceActions { get; } = [];
|
||||||
[JsonProperty("Primitives")]
|
[JsonProperty("Primitives")]
|
||||||
public List<INdmPrimitive> Primitives { get; } = [];
|
public List<INdmPrimitive> Primitives { get; } = [];
|
||||||
|
[JsonProperty("ConsiderSofteningFactor")]
|
||||||
|
public bool ConsiderSofteningFactor { get; set; } = false;
|
||||||
|
|
||||||
public CurvatureCalculatorInputDataDTO(Guid id)
|
public CurvatureCalculatorInputDataDTO(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace StructureHelper.Infrastructure
|
|||||||
// setup lighting
|
// setup lighting
|
||||||
AmbientLightColor = Colors.DimGray;
|
AmbientLightColor = Colors.DimGray;
|
||||||
DirectionalLightColor = Colors.White;
|
DirectionalLightColor = Colors.White;
|
||||||
DirectionalLightDirection = new Vector3D(-2, -5, -2);
|
DirectionalLightDirection = new Vector3D(-2, -5, 2);
|
||||||
|
|
||||||
BackgroundTexture =
|
BackgroundTexture =
|
||||||
BitmapExtensions.CreateLinearGradientBitmapStream(EffectsManager, 128, 128, Direct2DImageFormat.Bmp,
|
BitmapExtensions.CreateLinearGradientBitmapStream(EffectsManager, 128, 128, Direct2DImageFormat.Bmp,
|
||||||
|
|||||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
|||||||
using FieldVisualizer.WindowsOperation;
|
using FieldVisualizer.WindowsOperation;
|
||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
@@ -22,7 +23,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs)
|
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs, bool convertRectangles = false)
|
||||||
{
|
{
|
||||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||||
foreach (var valDelegate in resultFuncs)
|
foreach (var valDelegate in resultFuncs)
|
||||||
@@ -31,7 +32,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (INdm ndm in ndms)
|
foreach (INdm ndm in ndms)
|
||||||
{
|
{
|
||||||
primitives.Add(ProcessNdm(strainMatrix, valDelegate, ndm));
|
primitives.AddRange(ProcessNdm(strainMatrix, valDelegate, ndm, convertRectangles));
|
||||||
}
|
}
|
||||||
primitiveSet.ValuePrimitives = primitives;
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
primitiveSets.Add(primitiveSet);
|
primitiveSets.Add(primitiveSet);
|
||||||
@@ -72,35 +73,47 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
return valuePrimitive;
|
return valuePrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IValuePrimitive ProcessNdm(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, INdm ndm)
|
private static List<IValuePrimitive> ProcessNdm(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, INdm ndm, bool convertRectangles)
|
||||||
{
|
{
|
||||||
|
List<IValuePrimitive> valuePrimitives = [];
|
||||||
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
|
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
|
||||||
double val = delegateResult * valDelegate.UnitFactor;
|
double val = delegateResult * valDelegate.UnitFactor;
|
||||||
//val = roundLogic.RoundValue(val);
|
//val = roundLogic.RoundValue(val);
|
||||||
IValuePrimitive valuePrimitive;
|
IValuePrimitive valuePrimitive;
|
||||||
if (ndm is IRectangleNdm shapeNdm)
|
if (ndm is IRectangleNdm shapeNdm)
|
||||||
{
|
{
|
||||||
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
if (convertRectangles)
|
||||||
|
{
|
||||||
|
valuePrimitives.AddRange(ProcessRectangleToTriangles(shapeNdm, strainMatrix, valDelegate));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
||||||
|
valuePrimitives.Add(valuePrimitive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ndm is ITriangleNdm triangle)
|
else if (ndm is ITriangleNdm triangle)
|
||||||
{
|
{
|
||||||
//valuePrimitive = ProcessTriangle(triangle, val);
|
//valuePrimitive = ProcessTriangle(triangle, val);
|
||||||
valuePrimitive = ProcessTriangle(strainMatrix, valDelegate, triangle);
|
valuePrimitive = ProcessTriangle(strainMatrix, valDelegate, triangle);
|
||||||
|
valuePrimitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valuePrimitive = ProcessCircle(ndm, val);
|
valuePrimitive = ProcessCircle(ndm, val);
|
||||||
|
valuePrimitives.Add(valuePrimitive);
|
||||||
}
|
}
|
||||||
return valuePrimitive;
|
return valuePrimitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IValuePrimitive ProcessTriangle(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, ITriangleNdm triangle)
|
private static IValuePrimitive ProcessTriangle(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, ITriangleNdm triangle)
|
||||||
{
|
{
|
||||||
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, triangle);
|
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, triangle);
|
||||||
double val = delegateResult * valDelegate.UnitFactor;
|
double val = delegateResult * valDelegate.UnitFactor;
|
||||||
var moqNdm1 = new Ndm() { CenterX = triangle.Point1.X, CenterY = triangle.Point1.Y, Area = triangle.Area, Material = triangle.Material };
|
var moqLogic = new GetMoqNdmLogic();
|
||||||
var moqNdm2 = new Ndm() { CenterX = triangle.Point2.X, CenterY = triangle.Point2.Y, Area = triangle.Area, Material = triangle.Material };
|
var moqNdm1 = moqLogic.GetMockNdm(triangle, new Point2D(triangle.Point1.X, triangle.Point1.Y));
|
||||||
var moqNdm3 = new Ndm() { CenterX = triangle.Point3.X, CenterY = triangle.Point3.Y, Area = triangle.Area, Material = triangle.Material };
|
var moqNdm2 = moqLogic.GetMockNdm(triangle, new Point2D(triangle.Point2.X, triangle.Point2.Y));
|
||||||
|
var moqNdm3 = moqLogic.GetMockNdm(triangle, new Point2D(triangle.Point3.X, triangle.Point3.Y));
|
||||||
var primitive = new TrianglePrimitive()
|
var primitive = new TrianglePrimitive()
|
||||||
{
|
{
|
||||||
Point1 = new Point2D() { X = triangle.Point1.X, Y = triangle.Point1.Y },
|
Point1 = new Point2D() { X = triangle.Point1.X, Y = triangle.Point1.Y },
|
||||||
@@ -127,6 +140,19 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
// return primitive;
|
// return primitive;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
private static List<IValuePrimitive> ProcessRectangleToTriangles(IRectangleNdm shapeNdm, IStrainMatrix strainMatrix, ForceResultFunc valDelegate)
|
||||||
|
{
|
||||||
|
List<INdm> triangles = NdmTransform.ConvertRectangleToTriangleNdm(shapeNdm);
|
||||||
|
List<IValuePrimitive> valuePrimitives = [];
|
||||||
|
foreach (var item in triangles)
|
||||||
|
{
|
||||||
|
double delegateResult = valDelegate.ResultFunction.Invoke(strainMatrix, item);
|
||||||
|
double val = delegateResult * valDelegate.UnitFactor;
|
||||||
|
valuePrimitives.Add(ProcessTriangle(strainMatrix, valDelegate, (ITriangleNdm)item));
|
||||||
|
}
|
||||||
|
return valuePrimitives;
|
||||||
|
}
|
||||||
|
|
||||||
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
||||||
{
|
{
|
||||||
return new RectanglePrimitive()
|
return new RectanglePrimitive()
|
||||||
|
|||||||
@@ -12,8 +12,18 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
|||||||
public class CurvatureCalculatorInputDataViewModel : ViewModelBase
|
public class CurvatureCalculatorInputDataViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private ICurvatureCalculatorInputData inputData;
|
private ICurvatureCalculatorInputData inputData;
|
||||||
|
private bool considerSofteningFactor;
|
||||||
|
|
||||||
public DeflectionFactorViewModel DeflectionFactor { get; }
|
public DeflectionFactorViewModel DeflectionFactor { get; }
|
||||||
|
public bool ConsiderSofteningFactor
|
||||||
|
{
|
||||||
|
get => inputData.ConsiderSofteningFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
inputData.ConsiderSofteningFactor = value;
|
||||||
|
OnPropertyChanged(nameof(ConsiderSofteningFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; }
|
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; }
|
||||||
|
|||||||
@@ -48,11 +48,14 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="22"/>
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Grid.Row="0" Text="Span length"/>
|
<TextBlock Text="Span length"/>
|
||||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Softening factor"/>
|
||||||
|
<CheckBox Grid.Row="1" Grid.Column="1" Margin="0,3,0,0" IsChecked="{Binding InputDataViewModel.ConsiderSofteningFactor}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Expander Header="Maximum deflections" IsExpanded="True">
|
<Expander Header="Maximum deflections" IsExpanded="False">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="120"/>
|
<ColumnDefinition Width="120"/>
|
||||||
@@ -71,7 +74,7 @@
|
|||||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Nz, Converter={StaticResource LengthConverter}}"/>
|
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Nz, Converter={StaticResource LengthConverter}}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Deflection factors">
|
<Expander Header="Deflection factors" IsExpanded="False">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="120"/>
|
<ColumnDefinition Width="120"/>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Infrastructure.Geometry;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Models.States;
|
using StructureHelperCommon.Models.States;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
@@ -24,11 +26,20 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
CenterY = point.Y,
|
CenterY = point.Y,
|
||||||
Material = material,
|
Material = material,
|
||||||
};
|
};
|
||||||
var prestrain = (userPrestrain.Mx + autoPrestrain.Mx) * point.Y
|
StrainMatrix prestrainMatrix = new()
|
||||||
+ (userPrestrain.My + autoPrestrain.My) * point.X
|
{
|
||||||
+ userPrestrain.Nz + autoPrestrain.Nz;
|
Kx = (userPrestrain.Mx + autoPrestrain.Mx),
|
||||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, prestrain);
|
Ky = (userPrestrain.My + autoPrestrain.My),
|
||||||
|
EpsZ = userPrestrain.Nz + autoPrestrain.Nz
|
||||||
|
};
|
||||||
|
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, prestrainMatrix);
|
||||||
return ndm;
|
return ndm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public INdm GetMockNdm(INdm ndm, IPoint2D point)
|
||||||
|
{
|
||||||
|
INdm newNdm = NdmTransform.GetMoqNdmAtPoint(ndm, new PointLd2D(point.X, point.Y));
|
||||||
|
return newNdm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelper.Services.ResultViewers;
|
using StructureHelper.Services.ResultViewers;
|
||||||
using StructureHelper.Windows.Forces;
|
using StructureHelper.Windows.Forces;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
@@ -145,10 +146,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
CenterY = valuePoint.areaPoint.Point.Y,
|
CenterY = valuePoint.areaPoint.Point.Y,
|
||||||
Material = material,
|
Material = material,
|
||||||
};
|
};
|
||||||
var prestrain = (userPrestrain.Mx + autoPrestrain.Mx) * valuePoint.areaPoint.Point.Y
|
StrainMatrix prestrainMatrix = new()
|
||||||
+ (userPrestrain.My + autoPrestrain.My) * valuePoint.areaPoint.Point.X
|
{
|
||||||
+ userPrestrain.Nz + autoPrestrain.Nz;
|
Kx = (userPrestrain.Mx + autoPrestrain.Mx),
|
||||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, prestrain);
|
Ky = (userPrestrain.My + autoPrestrain.My),
|
||||||
|
EpsZ = userPrestrain.Nz + autoPrestrain.Nz
|
||||||
|
};
|
||||||
|
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, prestrainMatrix);
|
||||||
return ndm;
|
return ndm;
|
||||||
}
|
}
|
||||||
private List<string> GetValueLabels(IEnumerable<ForceResultFunc> selectedDelegates)
|
private List<string> GetValueLabels(IEnumerable<ForceResultFunc> selectedDelegates)
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
IStrainMatrix strainMatrix = SelectedResult.ForcesTupleResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
IStrainMatrix strainMatrix = SelectedResult.ForcesTupleResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
|
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs(), true);
|
||||||
var report = new IsoField3DReport(primitiveSets);
|
var report = new IsoField3DReport(primitiveSets);
|
||||||
report.Show();
|
report.Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using FieldVisualizer.Services.ColorServices;
|
||||||
|
using HelixToolkit.Geometry;
|
||||||
|
using HelixToolkit.Maths;
|
||||||
|
using HelixToolkit.SharpDX;
|
||||||
|
using HelixToolkit.SharpDX.Core;
|
||||||
|
using HelixToolkit.Wpf.SharpDX;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
|
{
|
||||||
|
public class GetModels3dByValuePrimivesLogic : IGetModels3dLogic
|
||||||
|
{
|
||||||
|
public double ZoomValue { get; set; }
|
||||||
|
public bool InvertNormal { get; set; }
|
||||||
|
public IColorMap ColorMap { get; set; }
|
||||||
|
public IValueRange ValueRange { get; set; }
|
||||||
|
public bool ShowZeroPlane { get; set; }
|
||||||
|
|
||||||
|
public void GetModels3d(IEnumerable<IValuePrimitive> valuePrimitives, Viewport3DX viewport)
|
||||||
|
{
|
||||||
|
foreach (var primitive in valuePrimitives)
|
||||||
|
{
|
||||||
|
if (primitive is ICirclePrimitive circlePrimitive)
|
||||||
|
{
|
||||||
|
if (circlePrimitive.Value != 0)
|
||||||
|
{
|
||||||
|
var model2 = CreateCylinder(circlePrimitive);
|
||||||
|
viewport.Items.Add(model2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (primitive is ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
var model2 = CreateTriangle(triangle);
|
||||||
|
viewport.Items.Add(model2);
|
||||||
|
if (ShowZeroPlane == true)
|
||||||
|
{
|
||||||
|
var model1 = CreateZeroTriangle(triangle);
|
||||||
|
viewport.Items.Add(model1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MeshGeometryModel3D CreateCylinder(ICirclePrimitive circle)
|
||||||
|
{
|
||||||
|
// Create mesh along Z-axis
|
||||||
|
var builder = new MeshBuilder();
|
||||||
|
|
||||||
|
Vector3 p0 = new Vector3((float)circle.CenterX, (float)circle.CenterY, 0); // bottom center
|
||||||
|
float cylinderHeight = (float)(circle.Value * ZoomValue);
|
||||||
|
Vector3 p1 = new Vector3((float)circle.CenterX, (float)circle.CenterY, cylinderHeight); // top center
|
||||||
|
|
||||||
|
builder.AddCylinder(p0, p1, (float)circle.Diameter, 8);
|
||||||
|
|
||||||
|
// Build geometry
|
||||||
|
var cylinderGeometry = builder.ToMeshGeometry3D();
|
||||||
|
|
||||||
|
// Create material (constant grey)
|
||||||
|
var material = new PhongMaterial
|
||||||
|
{
|
||||||
|
DiffuseColor = ToColor4(ColorOperations.GetColorByValue(ValueRange, ColorMap, circle.Value)),
|
||||||
|
SpecularShininess = 50f
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create model
|
||||||
|
var cylinderModel = new MeshGeometryModel3D
|
||||||
|
{
|
||||||
|
Geometry = cylinderGeometry,
|
||||||
|
Material = material
|
||||||
|
};
|
||||||
|
return cylinderModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MeshGeometryModel3D CreateZeroTriangle(ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
// Triangle vertices
|
||||||
|
Vector3 p0 = new Vector3((float)triangle.Point1.X, (float)triangle.Point1.Y, 0);
|
||||||
|
Vector3 p1 = new Vector3((float)triangle.Point2.X, (float)triangle.Point2.Y, 0);
|
||||||
|
Vector3 p2 = new Vector3((float)triangle.Point3.X, (float)triangle.Point3.Y, 0);
|
||||||
|
|
||||||
|
var builder = new MeshBuilder();
|
||||||
|
builder.AddTriangle(p0, p1, p2);
|
||||||
|
|
||||||
|
var mesh = builder.ToMeshGeometry3D();
|
||||||
|
|
||||||
|
var material = new PBRMaterial
|
||||||
|
{
|
||||||
|
AlbedoColor = new Color4(0.5f, 0.5f, 0.5f, 0.4f), // 40% opacity
|
||||||
|
RoughnessFactor = 0.8f,
|
||||||
|
MetallicFactor = 0.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var model = new MeshGeometryModel3D
|
||||||
|
{
|
||||||
|
Geometry = mesh,
|
||||||
|
Material = material,
|
||||||
|
CullMode = SharpDX.Direct3D11.CullMode.None,
|
||||||
|
InvertNormal = InvertNormal,
|
||||||
|
};
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MeshGeometryModel3D CreateTriangle(ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
// Triangle vertices
|
||||||
|
Vector3 p0 = new Vector3((float)triangle.Point1.X, (float)triangle.Point1.Y, (float)(triangle.ValuePoint1 * ZoomValue));
|
||||||
|
Vector3 p1 = new Vector3((float)triangle.Point2.X, (float)triangle.Point2.Y, (float)(triangle.ValuePoint2 * ZoomValue));
|
||||||
|
Vector3 p2 = new Vector3((float)triangle.Point3.X, (float)triangle.Point3.Y, (float)(triangle.ValuePoint3 * ZoomValue));
|
||||||
|
|
||||||
|
var builder = new MeshBuilder();
|
||||||
|
builder.AddTriangle(p0, p1, p2);
|
||||||
|
|
||||||
|
var mesh = builder.ToMeshGeometry3D();
|
||||||
|
|
||||||
|
var material = new PhongMaterial
|
||||||
|
{
|
||||||
|
DiffuseColor = ToColor4(ColorOperations.GetColorByValue(ValueRange, ColorMap, triangle.Value)),
|
||||||
|
SpecularShininess = 50f
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var model = new MeshGeometryModel3D
|
||||||
|
{
|
||||||
|
Geometry = mesh,
|
||||||
|
Material = material,
|
||||||
|
CullMode = SharpDX.Direct3D11.CullMode.None,
|
||||||
|
InvertNormal = InvertNormal
|
||||||
|
};
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color4 ToColor4(System.Windows.Media.Color c)
|
||||||
|
{
|
||||||
|
return new Color4(
|
||||||
|
c.R / 255f,
|
||||||
|
c.G / 255f,
|
||||||
|
c.B / 255f,
|
||||||
|
c.A / 255f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using HelixToolkit.Maths;
|
||||||
|
using HelixToolkit.Wpf.SharpDX;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
|
{
|
||||||
|
public interface IGetModels3dLogic
|
||||||
|
{
|
||||||
|
IColorMap ColorMap { get; set; }
|
||||||
|
bool InvertNormal { get; set; }
|
||||||
|
bool ShowZeroPlane { get; set; }
|
||||||
|
IValueRange ValueRange { get; set; }
|
||||||
|
double ZoomValue { get; set; }
|
||||||
|
|
||||||
|
static abstract Color4 ToColor4(System.Windows.Media.Color c);
|
||||||
|
void GetModels3d(IEnumerable<IValuePrimitive> valuePrimitives, Viewport3DX viewport);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,33 +5,87 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||||
xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
|
xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
d:DataContext="{d:DesignInstance local:IsoField3DViewerViewModel}"
|
d:DataContext="{d:DesignInstance local:IsoField3DViewerViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Contour 3DViewer" Height="450" Width="800" MinHeight="300" MinWidth="300" MaxHeight="1000" MaxWidth="1400" WindowStartupLocation="CenterScreen">
|
Title="Contour 3DViewer" Height="650" Width="800" MinHeight="300" MinWidth="300" MaxHeight="1000" MaxWidth="1400" WindowStartupLocation="CenterScreen">
|
||||||
<Grid>
|
<DockPanel>
|
||||||
<Grid.ColumnDefinitions>
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
<ColumnDefinition Width="200"/>
|
<ToolBar>
|
||||||
<ColumnDefinition/>
|
<Button Style="{StaticResource ToolButton}"
|
||||||
</Grid.ColumnDefinitions>
|
Command="{Binding RebuildCommand}">
|
||||||
<ListBox Name="SetsList" ItemsSource="{Binding PrimitiveSets}" SelectedItem="{Binding SelectedPrimitiveSet}">
|
<Button.ToolTip>
|
||||||
<ListBox.ItemTemplate>
|
<uc:ButtonToolTipEh HeaderText="Rebuild image"
|
||||||
<DataTemplate>
|
IconContent="{StaticResource Renew}"
|
||||||
<Grid Height="20">
|
DescriptionText="Rebuild current image"/>
|
||||||
<Grid.ColumnDefinitions>
|
</Button.ToolTip>
|
||||||
<ColumnDefinition Width="30"/>
|
<Viewbox>
|
||||||
<ColumnDefinition/>
|
<ContentControl ContentTemplate="{StaticResource Renew}"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Viewbox>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Path=Name}" Width="270"/>
|
</Button>
|
||||||
</Grid>
|
</ToolBar>
|
||||||
</DataTemplate>
|
</ToolBarTray>
|
||||||
</ListBox.ItemTemplate>
|
<Grid>
|
||||||
</ListBox>
|
<Grid.ColumnDefinitions>
|
||||||
<Grid Grid.Column="1">
|
<ColumnDefinition Width="200"/>
|
||||||
<Grid.RowDefinitions>
|
<ColumnDefinition/>
|
||||||
<RowDefinition Height="*"/>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="40"/>
|
<Grid>
|
||||||
</Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<hx:Viewport3DX x:Name="View3D" DataContext="{Binding ViewportViewModel}" Title="{Binding Title}"
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="100"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ListBox Name="SetsList" ItemsSource="{Binding PrimitiveSets}" SelectedItem="{Binding SelectedPrimitiveSet}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid Height="20">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="30"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Path=Name}" Width="270"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
|
<CheckBox Content="Show work plane" IsChecked="{Binding ShowZeroPlane}"/>
|
||||||
|
<CheckBox Content="Invert normals" IsChecked="{Binding InvertNormal}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<DockPanel Grid.Column="1">
|
||||||
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar DataContext="{Binding SaveCopyViewModel}">
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding CopyToClipboardCommand}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Copy to clipboard"
|
||||||
|
IconContent="{StaticResource CopyToClipboard}"
|
||||||
|
DescriptionText="Copy chart to clipboard as image"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource CopyToClipboard}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{DynamicResource ToolButton}" Command="{Binding SaveAsImageCommand}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Export to *.png"
|
||||||
|
IconContent="{StaticResource PngImage}"
|
||||||
|
DescriptionText="Export chart to *.png file"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource PngImage}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid x:Name="ViewportGrid" Background="White">
|
||||||
|
<hx:Viewport3DX x:Name="View3D" DataContext="{Binding ViewportViewModel}" Title="{Binding Title}"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
BackgroundColor="White"
|
BackgroundColor="White"
|
||||||
Camera="{Binding Camera}"
|
Camera="{Binding Camera}"
|
||||||
@@ -45,35 +99,38 @@ ShowCoordinateSystem="True"
|
|||||||
SubTitle="{Binding SubTitle}"
|
SubTitle="{Binding SubTitle}"
|
||||||
TextBrush="Black"
|
TextBrush="Black"
|
||||||
UseDefaultGestures="False">
|
UseDefaultGestures="False">
|
||||||
<hx:Viewport3DX.InputBindings>
|
<hx:Viewport3DX.InputBindings>
|
||||||
<KeyBinding Key="B"
|
<KeyBinding Key="B"
|
||||||
Command="hx:ViewportCommands.BackView" />
|
Command="hx:ViewportCommands.BackView" />
|
||||||
<KeyBinding Key="F"
|
<KeyBinding Key="F"
|
||||||
Command="hx:ViewportCommands.FrontView" />
|
Command="hx:ViewportCommands.FrontView" />
|
||||||
<KeyBinding Key="U"
|
<KeyBinding Key="U"
|
||||||
Command="hx:ViewportCommands.TopView" />
|
Command="hx:ViewportCommands.TopView" />
|
||||||
<KeyBinding Key="D"
|
<KeyBinding Key="D"
|
||||||
Command="hx:ViewportCommands.BottomView" />
|
Command="hx:ViewportCommands.BottomView" />
|
||||||
<KeyBinding Key="L"
|
<KeyBinding Key="L"
|
||||||
Command="hx:ViewportCommands.LeftView" />
|
Command="hx:ViewportCommands.LeftView" />
|
||||||
<KeyBinding Key="R"
|
<KeyBinding Key="R"
|
||||||
Command="hx:ViewportCommands.RightView" />
|
Command="hx:ViewportCommands.RightView" />
|
||||||
<KeyBinding Command="hx:ViewportCommands.ZoomExtents"
|
<KeyBinding Command="hx:ViewportCommands.ZoomExtents"
|
||||||
Gesture="Control+E" />
|
Gesture="Control+E" />
|
||||||
<MouseBinding Command="hx:ViewportCommands.Rotate"
|
<MouseBinding Command="hx:ViewportCommands.Rotate"
|
||||||
Gesture="RightClick" />
|
Gesture="RightClick" />
|
||||||
<MouseBinding Command="hx:ViewportCommands.Zoom"
|
<MouseBinding Command="hx:ViewportCommands.Zoom"
|
||||||
Gesture="MiddleClick" />
|
Gesture="MiddleClick" />
|
||||||
<MouseBinding Command="hx:ViewportCommands.Pan"
|
<MouseBinding Command="hx:ViewportCommands.Pan"
|
||||||
Gesture="LeftClick" />
|
Gesture="LeftClick" />
|
||||||
</hx:Viewport3DX.InputBindings>
|
</hx:Viewport3DX.InputBindings>
|
||||||
<hx:AmbientLight3D Color="{Binding AmbientLightColor}" />
|
<hx:AmbientLight3D Color="{Binding AmbientLightColor}" />
|
||||||
<hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}"
|
<hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}"
|
||||||
Color="{Binding DirectionalLightColor}" />
|
Color="{Binding DirectionalLightColor}" />
|
||||||
<hx:ScreenQuadModel3D Texture="{Binding BackgroundTexture}" />
|
<hx:ScreenQuadModel3D Texture="{Binding BackgroundTexture}" />
|
||||||
</hx:Viewport3DX>
|
</hx:Viewport3DX>
|
||||||
<Slider Grid.Row="1" Minimum="0" Maximum="100" Value="{Binding UserZoomFactor}"/>
|
</Grid>
|
||||||
|
<Slider Grid.Row="1" Minimum="0" Maximum="100" Value="{Binding UserZoomFactor}"/>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
</Grid>
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
this.viewModel = viewModel;
|
this.viewModel = viewModel;
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
viewModel.ViewportViewModel.Viewport3D = View3D;
|
viewModel.ViewportViewModel.Viewport3D = View3D;
|
||||||
viewModel.Refresh();
|
viewModel.SaveCopyViewModel.FrameWorkElement = ViewportGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,28 +5,24 @@ using FieldVisualizer.Entities.Values.Primitives;
|
|||||||
using FieldVisualizer.Services.ColorServices;
|
using FieldVisualizer.Services.ColorServices;
|
||||||
using FieldVisualizer.Services.PrimitiveServices;
|
using FieldVisualizer.Services.PrimitiveServices;
|
||||||
using FieldVisualizer.Services.ValueRanges;
|
using FieldVisualizer.Services.ValueRanges;
|
||||||
using HelixToolkit;
|
|
||||||
using HelixToolkit.Geometry;
|
using HelixToolkit.Geometry;
|
||||||
using HelixToolkit.Maths;
|
using HelixToolkit.Maths;
|
||||||
using HelixToolkit.SharpDX;
|
using HelixToolkit.SharpDX;
|
||||||
using HelixToolkit.Wpf.SharpDX;
|
using HelixToolkit.Wpf.SharpDX;
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Windows.Graphs;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Windows.Media;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using Color = HelixToolkit.Maths.Color;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||||
{
|
{
|
||||||
public class IsoField3DViewerViewModel : ViewModelBase
|
public class IsoField3DViewerViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
const int RangeNumber = 16;
|
const int RangeNumber = 16;
|
||||||
private int userZoomFactor = 100;
|
private int userZoomFactor = 30;
|
||||||
private IEnumerable<IPrimitiveSet> primitiveSets;
|
private IEnumerable<IPrimitiveSet> primitiveSets;
|
||||||
private Element3D item0;
|
private Element3D item0;
|
||||||
private Element3D item1;
|
private Element3D item1;
|
||||||
@@ -39,8 +35,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
private IColorMap _ColorMap;
|
private IColorMap _ColorMap;
|
||||||
private ColorMapsTypes _ColorMapType;
|
private ColorMapsTypes _ColorMapType;
|
||||||
|
|
||||||
|
|
||||||
public ContourViewportViewModel ViewportViewModel { get; } = new ContourViewportViewModel();
|
public ContourViewportViewModel ViewportViewModel { get; } = new ContourViewportViewModel();
|
||||||
public IEnumerable<IPrimitiveSet> PrimitiveSets { get => primitiveSets;}
|
public IEnumerable<IPrimitiveSet> PrimitiveSets { get => primitiveSets;}
|
||||||
|
public SaveCopyFWElementViewModel SaveCopyViewModel { get; private set; } = new();
|
||||||
|
|
||||||
public IsoField3DViewerViewModel(IEnumerable<IPrimitiveSet> primitiveSets)
|
public IsoField3DViewerViewModel(IEnumerable<IPrimitiveSet> primitiveSets)
|
||||||
{
|
{
|
||||||
@@ -54,6 +52,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
selectedPrimitiveSet = value;
|
selectedPrimitiveSet = value;
|
||||||
|
ViewportViewModel.Title = selectedPrimitiveSet.Name;
|
||||||
OnPropertyChanged(nameof(SelectedPrimitiveSet));
|
OnPropertyChanged(nameof(SelectedPrimitiveSet));
|
||||||
RebuildPrimitives();
|
RebuildPrimitives();
|
||||||
}
|
}
|
||||||
@@ -66,12 +65,32 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
userZoomFactor = value;
|
userZoomFactor = value;
|
||||||
OnPropertyChanged(nameof(UserZoomFactor));
|
OnPropertyChanged(nameof(UserZoomFactor));
|
||||||
RebuildPrimitives ();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShowZeroPlane
|
||||||
|
{
|
||||||
|
get => showZeroPlane;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
showZeroPlane = value;
|
||||||
|
OnPropertyChanged(nameof(ShowZeroPlane));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool InvertNormal
|
||||||
|
{
|
||||||
|
get => invertNormal;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
invertNormal = value;
|
||||||
|
OnPropertyChanged(nameof(InvertNormal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RebuildPrimitives()
|
private void RebuildPrimitives()
|
||||||
{
|
{
|
||||||
|
if (SelectedPrimitiveSet is null) { return; }
|
||||||
SetColor();
|
SetColor();
|
||||||
item0 = ViewportViewModel.Viewport3D.Items[0];
|
item0 = ViewportViewModel.Viewport3D.Items[0];
|
||||||
item1 = ViewportViewModel.Viewport3D.Items[1];
|
item1 = ViewportViewModel.Viewport3D.Items[1];
|
||||||
@@ -81,61 +100,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
ViewportViewModel.Viewport3D.Items.Add(item1);
|
ViewportViewModel.Viewport3D.Items.Add(item1);
|
||||||
ViewportViewModel.Viewport3D.Items.Add(item2);
|
ViewportViewModel.Viewport3D.Items.Add(item2);
|
||||||
double maxValue = SelectedPrimitiveSet.ValuePrimitives.Max(x => x.Value) - SelectedPrimitiveSet.ValuePrimitives.Min(x => x.Value);
|
double maxValue = SelectedPrimitiveSet.ValuePrimitives.Max(x => x.Value) - SelectedPrimitiveSet.ValuePrimitives.Min(x => x.Value);
|
||||||
zoomValue = UserZoomFactor / 100.0 / maxValue;
|
zoomValue = (Math.Pow(1.1, UserZoomFactor) - 1) / 100.0 / maxValue;
|
||||||
foreach (var primitive in SelectedPrimitiveSet.ValuePrimitives)
|
var logic = new GetModels3dByValuePrimivesLogic()
|
||||||
{
|
{
|
||||||
if (primitive is ITrianglePrimitive triangle)
|
ZoomValue = zoomValue,
|
||||||
{
|
ShowZeroPlane = ShowZeroPlane,
|
||||||
var model = CreateTriangle(triangle);
|
InvertNormal = InvertNormal,
|
||||||
ViewportViewModel.Viewport3D.Items.Add(model);
|
ColorMap = _ColorMap,
|
||||||
}
|
ValueRange = valueRange,
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private MeshGeometryModel3D CreateTriangle(ITrianglePrimitive triangle)
|
|
||||||
{
|
|
||||||
// Triangle vertices
|
|
||||||
Vector3 p0 = new Vector3((float)triangle.Point1.X, (float)triangle.Point1.Y, (float)(triangle.ValuePoint1 * zoomValue));
|
|
||||||
Vector3 p1 = new Vector3((float)triangle.Point2.X, (float)triangle.Point2.Y, (float)(triangle.ValuePoint2 * zoomValue));
|
|
||||||
Vector3 p2 = new Vector3((float)triangle.Point3.X, (float)triangle.Point3.Y, (float)(triangle.ValuePoint3 * zoomValue));
|
|
||||||
|
|
||||||
var builder = new MeshBuilder();
|
|
||||||
builder.AddTriangle(p0, p1, p2);
|
|
||||||
|
|
||||||
var mesh = builder.ToMeshGeometry3D();
|
|
||||||
|
|
||||||
var material = new PhongMaterial
|
|
||||||
{
|
|
||||||
DiffuseColor = ToColor4(ColorOperations.GetColorByValue(valueRange, _ColorMap, triangle.Value)),
|
|
||||||
SpecularShininess = 50f
|
|
||||||
};
|
};
|
||||||
|
logic.GetModels3d(SelectedPrimitiveSet.ValuePrimitives, ViewportViewModel.Viewport3D);
|
||||||
|
|
||||||
var model = new MeshGeometryModel3D
|
|
||||||
{
|
|
||||||
Geometry = mesh,
|
|
||||||
Material = material,
|
|
||||||
CullMode = SharpDX.Direct3D11.CullMode.None,
|
|
||||||
ToolTip = triangle.Value
|
|
||||||
};
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Color4 ToColor4(System.Windows.Media.Color c)
|
|
||||||
{
|
|
||||||
return new Color4(
|
|
||||||
c.R / 255f,
|
|
||||||
c.G / 255f,
|
|
||||||
c.B / 255f,
|
|
||||||
c.A / 255f
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Refresh()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetColor()
|
private void SetColor()
|
||||||
@@ -144,5 +118,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
valueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
valueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
||||||
valueColorRanges = ColorOperations.GetValueColorRanges(valueRange, valueRanges, _ColorMap);
|
valueColorRanges = ColorOperations.GetValueColorRanges(valueRange, valueRanges, _ColorMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RelayCommand rebuildCommand;
|
||||||
|
private bool showZeroPlane = true;
|
||||||
|
private bool invertNormal = false;
|
||||||
|
|
||||||
|
public ICommand RebuildCommand => rebuildCommand ??= new RelayCommand(Rebuild);
|
||||||
|
|
||||||
|
private void Rebuild(object commandParameter)
|
||||||
|
{
|
||||||
|
RebuildPrimitives();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
var exitMx = stiffness[0, 0] * strain.Kx + stiffness[0, 1] * strain.Ky + stiffness[0, 2] * strain.EpsZ;
|
var exitMx = stiffness[0, 0] * strain.Kx + stiffness[0, 1] * strain.Ky + stiffness[0, 2] * strain.EpsZ;
|
||||||
var exitMy = stiffness[1, 0] * strain.Kx + stiffness[1, 1] * strain.Ky + stiffness[1, 2] * strain.EpsZ;
|
var exitMy = stiffness[1, 0] * strain.Kx + stiffness[1, 1] * strain.Ky + stiffness[1, 2] * strain.EpsZ;
|
||||||
var exitNz = stiffness[2, 0] * strain.Kx + stiffness[2, 1] * strain.Ky + stiffness[2, 2] * strain.EpsZ;
|
var exitNz = stiffness[2, 0] * strain.Kx + stiffness[2, 1] * strain.Ky + stiffness[2, 2] * strain.EpsZ;
|
||||||
var PrestressMatrix = new ForceLogic()
|
var PrestressMatrix = new CalculateForceMatrixLogic()
|
||||||
.GetPrestressMatrix(new StiffnessLogic(), ndmCollection, strain);
|
.GetPrestressMatrix(new StiffnessLogic(), ndmCollection, strain);
|
||||||
double mx = exitMx + PrestressMatrix.Mx;
|
double mx = exitMx + PrestressMatrix.Mx;
|
||||||
double my = exitMy + PrestressMatrix.My;
|
double my = exitMy + PrestressMatrix.My;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
|
|
||||||
public List<INdmPrimitive> Primitives { get; } = [];
|
public List<INdmPrimitive> Primitives { get; } = [];
|
||||||
public IDeflectionFactor DeflectionFactor { get; set; } = new DeflectionFactor(Guid.NewGuid());
|
public IDeflectionFactor DeflectionFactor { get; set; } = new DeflectionFactor(Guid.NewGuid());
|
||||||
|
public bool ConsiderSofteningFactor { get; set; } = false;
|
||||||
|
|
||||||
public CurvatureCalculatorInputData(Guid id)
|
public CurvatureCalculatorInputData(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Logics;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
@@ -36,16 +38,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
PrepareResult();
|
PrepareResult();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (CheckForCracks(InputData.ForcePair.FullForceTuple, CalcTerms.ShortTerm) || CheckForCracks(InputData.ForcePair.LongForceTuple, CalcTerms.ShortTerm))
|
GetCaclculator();
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage($"Section is cracked");
|
|
||||||
calculator = new CurvatureTermCrackedCalculator(TraceLogger) { InputData = InputData };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage($"Section is not cracked");
|
|
||||||
calculator = new CurvatureTermUncrackedCalculator(TraceLogger) { InputData = InputData };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -64,7 +57,26 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
result.SectionResult = calcResult;
|
result.SectionResult = calcResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckForCracks(IForceTuple forceTuple, CalcTerms calcTerm)
|
private void GetCaclculator()
|
||||||
|
{
|
||||||
|
if (InputData.ConsiderSofteningFactor == false)
|
||||||
|
{
|
||||||
|
calculator = new CurvatureTermUncrackedCalculator(TraceLogger) { InputData = InputData };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (IsSectionCracked(InputData.ForcePair.FullForceTuple, CalcTerms.ShortTerm) || IsSectionCracked(InputData.ForcePair.LongForceTuple, CalcTerms.ShortTerm))
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Section is cracked");
|
||||||
|
calculator = new CurvatureTermCrackedCalculator(TraceLogger) { InputData = InputData };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Section is not cracked");
|
||||||
|
calculator = new CurvatureTermUncrackedCalculator(TraceLogger) { InputData = InputData };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsSectionCracked(IForceTuple forceTuple, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
var triangulateLogic = new TriangulatePrimitiveLogic()
|
var triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
{
|
{
|
||||||
@@ -74,6 +86,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
TraceLogger = TraceLogger
|
TraceLogger = TraceLogger
|
||||||
};
|
};
|
||||||
var ndms = triangulateLogic.GetNdms();
|
var ndms = triangulateLogic.GetNdms();
|
||||||
|
if (!ndms.Where(x => x.Material is ICrackMaterial).Any())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var logic = new IsSectionCrackedByForceLogic()
|
var logic = new IsSectionCrackedByForceLogic()
|
||||||
{
|
{
|
||||||
ForceTuple = forceTuple,
|
ForceTuple = forceTuple,
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
public IDesignForcePair ForcePair { get; set; }
|
public IDesignForcePair ForcePair { get; set; }
|
||||||
public List<INdmPrimitive> Primitives { get; set; } = [];
|
public List<INdmPrimitive> Primitives { get; set; } = [];
|
||||||
public IDeflectionFactor DeflectionFactor { get; set; }
|
public IDeflectionFactor DeflectionFactor { get; set; }
|
||||||
|
public bool ConsiderSofteningFactor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
public interface ICurvatureCalculatorInputData : IInputData, ISaveable, IHasForceActions, IHasPrimitives
|
public interface ICurvatureCalculatorInputData : IInputData, ISaveable, IHasForceActions, IHasPrimitives
|
||||||
{
|
{
|
||||||
IDeflectionFactor DeflectionFactor { get; set; }
|
IDeflectionFactor DeflectionFactor { get; set; }
|
||||||
|
bool ConsiderSofteningFactor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
{
|
{
|
||||||
IDesignForcePair ForcePair {get;set;}
|
IDesignForcePair ForcePair {get;set;}
|
||||||
IDeflectionFactor DeflectionFactor { get; set; }
|
IDeflectionFactor DeflectionFactor { get; set; }
|
||||||
|
bool ConsiderSofteningFactor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
|
|
||||||
if (ReferenceEquals(target, source))
|
if (ReferenceEquals(target, source))
|
||||||
return;
|
return;
|
||||||
|
target.ConsiderSofteningFactor = source.ConsiderSofteningFactor;
|
||||||
if (UpdateChildren)
|
if (UpdateChildren)
|
||||||
{
|
{
|
||||||
ValidateChildProperties(target, source);
|
ValidateChildProperties(target, source);
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
|||||||
{
|
{
|
||||||
ForcePair = pair,
|
ForcePair = pair,
|
||||||
Primitives = InputData.Primitives,
|
Primitives = InputData.Primitives,
|
||||||
DeflectionFactor = InputData.DeflectionFactor
|
DeflectionFactor = InputData.DeflectionFactor,
|
||||||
|
ConsiderSofteningFactor = InputData.ConsiderSofteningFactor,
|
||||||
};
|
};
|
||||||
ForceCalculator.InputData = forceInputData;
|
ForceCalculator.InputData = forceInputData;
|
||||||
ForceCalculator.Run();
|
ForceCalculator.Run();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
@@ -6,11 +7,6 @@ using StructureHelperCommon.Infrastructures.Exceptions;
|
|||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||||
{
|
{
|
||||||
@@ -42,7 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
{
|
{
|
||||||
inputData.ReinforcementStress = inputData.ReinforcementStrength;
|
inputData.ReinforcementStress = inputData.ReinforcementStrength;
|
||||||
}
|
}
|
||||||
inputData.IsPrestressed = ndm.PrestrainLogic.GetByType(PrestrainTypes.Prestrain).Sum(x => x.PrestrainValue) > 0.0005d ? true : false;
|
var prestrainLogic = new GetNdmPrestrainLogic();
|
||||||
|
var prestrainValue = prestrainLogic.GetPrestrainValueAtCenter(ndm);
|
||||||
|
inputData.IsPrestressed = prestrainValue > 0.0005d ? true : false;
|
||||||
inputData.LappedCountRate = lappedCountRate;
|
inputData.LappedCountRate = lappedCountRate;
|
||||||
return inputData;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using StructureHelperCommon.Models;
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System.Diagnostics.Eventing.Reader;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
@@ -46,7 +45,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
IEnumerable<INdm> checkedNdmCollection;
|
IEnumerable<INdm> checkedNdmCollection;
|
||||||
var isSectionCracked = stressLogic.IsSectionCracked(strainMatrix, CheckedNdmCollection);
|
var crackLogic = new CrackedSectionLogic();
|
||||||
|
var isSectionCracked = crackLogic.IsSectionCracked(strainMatrix, CheckedNdmCollection);
|
||||||
if (isSectionCracked == true)
|
if (isSectionCracked == true)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Cracks are appeared in cross-section for current force combination");
|
TraceLogger?.AddMessage($"Cracks are appeared in cross-section for current force combination");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
@@ -9,6 +10,7 @@ using StructureHelperCommon.Services.Forces;
|
|||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using System.Runtime.Intrinsics.Arm;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
var strainMatrix = ForceTupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
var strainMatrix = ForceTupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||||
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
||||||
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
||||||
result.ConcreteStrain = -concreteNdm.PrestrainLogic.GetAll().Sum(x => x.PrestrainValue);
|
var prestrainLogic = new GetNdmPrestrainLogic();
|
||||||
|
var prestrainValue = prestrainLogic.GetPrestrainValueAtCenter(concreteNdm);
|
||||||
|
result.ConcreteStrain = - prestrainValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareNewResult()
|
private void PrepareNewResult()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
@@ -13,6 +14,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Intrinsics.Arm;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -107,10 +109,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
rebarActualStrain = actualRebarResult.RebarStrain;
|
rebarActualStrain = actualRebarResult.RebarStrain;
|
||||||
rebarActualStress = actualRebarResult.RebarStress;
|
rebarActualStress = actualRebarResult.RebarStress;
|
||||||
TraceLogger?.AddMessage($"Actual strain of rebar EpsilonS = {rebarActualStrain}(dimensionless)");
|
TraceLogger?.AddMessage($"Actual strain of rebar EpsilonS = {rebarActualStrain}(dimensionless)");
|
||||||
concreteStrainActual = concreteNdm
|
var prestrainLogic = new GetNdmPrestrainLogic();
|
||||||
.PrestrainLogic
|
concreteStrainActual = prestrainLogic.GetPrestrainValueAtCenter(concreteNdm);
|
||||||
.GetAll()
|
|
||||||
.Sum(x => x.PrestrainValue);
|
|
||||||
TraceLogger?.AddMessage($"Actual strain of concrete on the axis of rebar EpsilonC = {concreteStrainActual}(dimensionless)");
|
TraceLogger?.AddMessage($"Actual strain of concrete on the axis of rebar EpsilonC = {concreteStrainActual}(dimensionless)");
|
||||||
if (crackResult.IsSectionCracked == false)
|
if (crackResult.IsSectionCracked == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Matrix;
|
|
||||||
using LoaderCalculator.Data.Ndms;
|
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Windows.Forms.Design.AxImporter;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
@@ -38,11 +40,12 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
|||||||
var material = ndm.Material;
|
var material = ndm.Material;
|
||||||
var materialFunc = material.Diagram;
|
var materialFunc = material.Diagram;
|
||||||
var newMaterialFunc = (double strain) => strain * material.InitModulus;
|
var newMaterialFunc = (double strain) => strain * material.InitModulus;
|
||||||
var existingPrestrain = ndm.PrestrainLogic.GetAll().Sum(x => x.PrestrainValue);
|
var prestrainLogic = new GetNdmPrestrainLogic();
|
||||||
|
var existingPrestrain = prestrainLogic.GetPrestrainValueAtCenter(ndm);
|
||||||
var newPrestrain = materialFunc(existingPrestrain) / material.InitModulus;
|
var newPrestrain = materialFunc(existingPrestrain) / material.InitModulus;
|
||||||
ndm.Material.Diagram = newMaterialFunc;
|
ndm.Material.Diagram = newMaterialFunc;
|
||||||
ndm.PrestrainLogic.DeleteAll();
|
ndm.PrestrainLogic.DeleteAll();
|
||||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, newPrestrain);
|
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, new StrainMatrix() { EpsZ = newPrestrain });
|
||||||
}
|
}
|
||||||
return ndms;
|
return ndms;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Ndms.Transformations;
|
|
||||||
using LoaderCalculator.Data.Planes;
|
using LoaderCalculator.Data.Planes;
|
||||||
using LoaderCalculator.Data.SourceData;
|
using LoaderCalculator.Data.SourceData;
|
||||||
using LoaderCalculator.Tests.Infrastructures.Logics;
|
using LoaderCalculator.Tests.Infrastructures.Logics;
|
||||||
|
|||||||
Reference in New Issue
Block a user