From a3e21daf71876e62f64ca2d4baf947405e48ec5d Mon Sep 17 00:00:00 2001 From: sbosse Date: Fri, 29 Nov 2024 16:31:22 +0100 Subject: [PATCH] Fri 29 Nov 2024 04:30:50 PM CET --- src/SimNDT/core/geometryObjects.py | 191 +++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 src/SimNDT/core/geometryObjects.py diff --git a/src/SimNDT/core/geometryObjects.py b/src/SimNDT/core/geometryObjects.py new file mode 100644 index 0000000..5d3d144 --- /dev/null +++ b/src/SimNDT/core/geometryObjects.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +geometryObjects.py + +Created by Miguel Molero on 2013-09-04. +Copyright (c) 2013 MMolero. All rights reserved. +""" + + +class Ellipse: + + def __init__(self,x0=50,y0=50,a=10,b=5,theta=0,Label=0): + self.x0 = x0 + self.y0 = y0 + self.a = a + self.b = b + self.theta = theta + self.Label = Label + self.Name = "ellipse" + + def __str__(self): + return ("Ellipse: Center=({}, {}), " + "Semi-Major Axis={}, Semi-Minor Axis={}, " + "Rotation={} degrees, Label={}").format( + self.x0, self.y0, self.a, self.b, self.theta, self.Label) + + def __repr__(self): + return ("Ellipse(x0={}, y0={}, a={}, b={}, " + "theta={}, Label={})").format( + self.x0, self.y0, self.a, self.b, self.theta, self.Label) + + +class Circle: + + def __init__(self,x0=50,y0=50, r=10,Label=0): + self.x0 = x0 + self.y0 = y0 + self.r = r + self.Label = Label + self.Name = "circle" + + def __str__(self): + return "Circle: Center=({}, {}), Radius={}, Label={}".format( + self.x0, self.y0, self.r, self.Label) + + def __repr__(self): + return "Circle(x0={}, y0={}, r={}, Label={})".format( + self.x0, self.y0, self.r, self.Label) + + +class Rectangle: + def __init__(self,x0=50,y0=50, W=50,H=50,theta=0,Label=0): + self.x0 = x0 + self.y0 = y0 + self.W = W + self.H = H + self.theta = theta + self.Label = Label + self.Name = "rectangle" + + def __str__(self): + return ("Rectangle: Center=({}, {}), " + "Width={}, Height={}, " + "Rotation={} degrees, Label={}").format( + self.x0, self.y0, self.W, self.H, self.theta, self.Label) + + def __repr__(self): + return ("Rectangle(x0={}, y0={}, W={}, H={}, " + "theta={}, Label={})").format( + self.x0, self.y0, self.W, self.H, self.theta, self.Label) + + +class Square: + def __init__(self,x0=50,y0=50, L=50,theta=0,Label=0): + self.x0 = x0 + self.y0 = y0 + self.L = L + self.theta = theta + self.Label = Label + self.Name = "square" + + def __str__(self): + return ("Square: Center=({}, {}), " + "Side Length={}, Rotation={} degrees, Label={}").format( + self.x0, self.y0, self.L, self.theta, self.Label) + + def __repr__(self): + return ("Square(x0={}, y0={}, L={}, " + "theta={}, Label={})").format( + self.x0, self.y0, self.L, self.theta, self.Label) + + +class Inclusions: + def __init__(self, Diameter=1.0, Fraction=0.10, Label=60): + self.Diameter = Diameter + self.Fraction = Fraction + self.Label = Label + self.Name = "inclusion" + + + + +class Concrete2Phase: + def __init__(self, Fraction=0.1, LabelAggregate=40, MinDiameter=0.5, MaxDiameter=10.0, + Grading=0.10, MinAspectRatio=0.5, MaxAspectRatio=0.80): + + self.Fraction = Fraction + self.LabelAggregate = LabelAggregate + self.MinDiameter = MinDiameter + self.MaxDiameter = MaxDiameter + self.Grading = Grading + self.MinAspectRatio = MinAspectRatio + self.MaxAspectRatio = MaxAspectRatio + self.Name = "Concrete2Phase" + + +class Concrete2PhaseImmersion: + def __init__(self, Fraction=0.1, LabelMatrix=40, MinDiameter=0.5, MaxDiameter=10.0, + Grading=0.10, MinAspectRatio=0.5, MaxAspectRatio=0.80, + BoxWidth=50, BoxHeight=50, isCircular=False, LabelAggregate=80): + + self.Fraction = Fraction + self.LabelMatrix = LabelMatrix + self.MinDiameter = MinDiameter + self.MaxDiameter = MaxDiameter + self.Grading = Grading + self.MinAspectRatio = MinAspectRatio + self.MaxAspectRatio = MaxAspectRatio + + self.BoxWidth = BoxWidth + self.BoxHeight = BoxHeight + self.isCircular = isCircular + self.LabelAggregate = LabelAggregate + + self.Name = "Concrete2PhaseImmersion" + + + +class Concrete3Phase: + def __init__(self, Fraction=10, LabelAggregate=40, MinDiameter=0.5, MaxDiameter=10.0, + Grading=0.10, MinAspectRatio=0.5, MaxAspectRatio=0.80, + FractionsAir = 0.01, LabelAir =80, MinDiameterAir=0.5, MaxDiameterAir=1.0, GradingAir=0.1): + + self.Fraction = Fraction + self.LabelAggregate = LabelAggregate + self.MinDiameter = MinDiameter + self.MaxDiameter = MaxDiameter + self.Grading = Grading + self.MinAspectRatio = MinAspectRatio + self.MaxAspectRatio = MaxAspectRatio + + self.FractionAir = FractionsAir + self.LabelAir = LabelAir + self.MinDiameterAir = MinDiameterAir + self.MaxDiameterAir = MaxDiameterAir + self.GradingAir = GradingAir + + + self.Name = "Concrete3Phase" + +class Concrete3PhaseImmersion: + + def __init__(self, LabelMatrix = 40, Fraction=0.1, LabelAggregate=80, MinDiameter=0.5, MaxDiameter=10.0, + Grading=0.10, MinAspectRatio=0.5, MaxAspectRatio=0.80, + FractionsAir = 0.01, LabelAir =120, MinDiameterAir=0.5, MaxDiameterAir=1.0, GradingAir=0.1, + BoxWidth=50, BoxHeight=50, isCircular=False ): + + self.Fraction = Fraction + self.LabelMatrix = LabelMatrix + self.LabelAggregate = LabelAggregate + self.MinDiameter = MinDiameter + self.MaxDiameter = MaxDiameter + self.Grading = Grading + self.MinAspectRatio = MinAspectRatio + self.MaxAspectRatio = MaxAspectRatio + + self.FractionAir = FractionsAir + self.LabelAir = LabelAir + self.MinDiameterAir = MinDiameterAir + self.MaxDiameterAir = MaxDiameterAir + self.GradingAir = GradingAir + + self.BoxWidth = BoxWidth + self.BoxHeight = BoxHeight + self.isCircular = isCircular + + + + + self.Name = "Concrete3PhaseImmersion" \ No newline at end of file