Circle Primitive Added
This commit is contained in:
@@ -4,39 +4,44 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Ndms.Transformations;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
public class RectangleTriangulationLogic : IRectangleTriangulationLogic
|
||||
{
|
||||
IRectangleTriangulationLogicOptions options;
|
||||
public ITriangulationLogicOptions Options { get; }
|
||||
|
||||
public IEnumerable<INdm> GetNdmCollection(IMaterial material)
|
||||
{
|
||||
IRectangleTriangulationLogicOptions rectangleOptions = Options as IRectangleTriangulationLogicOptions;
|
||||
double width = rectangleOptions.Rectangle.Width;
|
||||
double height = rectangleOptions.Rectangle.Height;
|
||||
double ndmMaxSize = rectangleOptions.NdmMaxSize;
|
||||
int ndmMinDivision = rectangleOptions.NdmMinDivision;
|
||||
double width = options.Rectangle.Width;
|
||||
double height = options.Rectangle.Height;
|
||||
double ndmMaxSize = options.NdmMaxSize;
|
||||
int ndmMinDivision = options.NdmMinDivision;
|
||||
LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions logicOptions = new LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions(width, height, ndmMaxSize, ndmMinDivision);
|
||||
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
|
||||
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.RectangularPlane { Material = material });
|
||||
double dX = rectangleOptions.Center.X;
|
||||
double dY = rectangleOptions.Center.Y;
|
||||
NdmTransform.Move(ndmCollection, dX, dY);
|
||||
double angle = rectangleOptions.Rectangle.Angle;
|
||||
TriangulationService.CommonTransform(ndmCollection, options);
|
||||
double angle = options.Rectangle.Angle;
|
||||
NdmTransform.Rotate(ndmCollection, angle);
|
||||
NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
|
||||
TriangulationService.SetPrestrain(ndmCollection, options.Prestrain);
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
public void ValidateOptions(ITriangulationLogicOptions options)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (options is not IRectangleTriangulationLogicOptions)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"\n Expected: {nameof(IRectangleTriangulationLogicOptions)}, But was: {nameof(options)}");
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleTriangulationLogic(ITriangulationLogicOptions options)
|
||||
{
|
||||
ValidateOptions(options);
|
||||
this.options = options as IRectangleTriangulationLogicOptions;
|
||||
Options = options;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user