# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/utilities.py
# def round_value(value, decimalplaces=0):
#     """Rounding function.
# 
#     Args:
#         value (float): Number to round.
#         decimalplaces (int): Number of decimal places of float to represent rounded value.
# 
#     Returns:
#         rounded (int/float): Rounded value.
#     """
# 
#     # Rounds to nearest integer (half values are rounded downwards)
#     if decimalplaces == 0:
#         rounded = int(d.Decimal(value).quantize(d.Decimal('1'), rounding=d.ROUND_HALF_DOWN))
# 
#     # Rounds down to nearest float represented by number of decimal places
#     else:
#         precision = '1.{places}'.format(places='0' * decimalplaces)
#         rounded = float(d.Decimal(value).quantize(d.Decimal(precision), rounding=d.ROUND_FLOOR))
# 
#     return rounded


import numpy as np
from scipy import fftpack
from gprMax.constants import floattype
from gprMax.constants import complextype
from gprMax.fractals_generate_ext import generate_fractal2D
from gprMax.fractals_generate_ext import generate_fractal3D
from gprMax.utilities import round_value
        self.seed = None

        # Randomly defined parameters that will be used to calculate geometry
        self.R1 = np.random.RandomState(self.seed)
        self.R2 = np.random.RandomState(self.seed)
        self.R3 = np.random.RandomState(self.seed)
        self.R4 = np.random.RandomState(self.seed)
        self.R5 = np.random.RandomState(self.seed)
        self.R6 = np.random.RandomState(self.seed)

        for i in range(self.numblades):
            self.geometryparams[i, 0] = 10 + 20 * self.R1.random_sample()
            self.geometryparams[i, 1] = 10 + 20 * self.R2.random_sample()
            self.geometryparams[i, 2] = self.R3.choice([-1, 1])
            self.geometryparams[i, 3] = self.R4.choice([-1, 1])

    def calculate_blade_geometry(self, blade, height):
        """Calculates the x and y coordinates for a given height of grass blade.

        Args:
            blade (int): Numeric ID of grass blade.
            height (float): Height of grass blade.

        Returns:
            x, y (float): x and y coordinates of grass blade.
        """

        x = self.geometryparams[blade, 2] * (height / self.geometryparams[blade, 0]) * (height / self.geometryparams[blade, 0])
        y = self.geometryparams[blade, 3] * (height / self.geometryparams[blade, 1]) * (height / self.geometryparams[blade, 1])
        x = round_value(x)

# Path: gprMax/constants.py

# 
# Path: gprMax/constants.py

# 
# Path: gprMax/utilities.py
# def round_value(value, decimalplaces=0):
#     """Rounding function.
# 
#     Args:
#         value (float): Number to round.
#         decimalplaces (int): Number of decimal places of float to represent rounded value.
# 
#     Returns:
#         rounded (int/float): Rounded value.
#     """
# 
#     # Rounds to nearest integer (half values are rounded downwards)
#     if decimalplaces == 0:
#         rounded = int(d.Decimal(value).quantize(d.Decimal('1'), rounding=d.ROUND_HALF_DOWN))
# 
#     # Rounds down to nearest float represented by number of decimal places
#     else:
#         precision = '1.{places}'.format(places='0' * decimalplaces)
#         rounded = float(d.Decimal(value).quantize(d.Decimal(precision), rounding=d.ROUND_FLOOR))
# 
#     return rounded


# Path: gprMax/fractals.py
import numpy as np
from scipy import fftpack
from gprMax.constants import floattype
from gprMax.constants import complextype
from gprMax.fractals_generate_ext import generate_fractal2D
from gprMax.fractals_generate_ext import generate_fractal3D
from gprMax.utilities import round_value

        self.seed = None

        # Randomly defined parameters that will be used to calculate geometry
        self.R1 = np.random.RandomState(self.seed)
        self.R2 = np.random.RandomState(self.seed)
        self.R3 = np.random.RandomState(self.seed)
        self.R4 = np.random.RandomState(self.seed)
        self.R5 = np.random.RandomState(self.seed)
        self.R6 = np.random.RandomState(self.seed)

        for i in range(self.numblades):
            self.geometryparams[i, 0] = 10 + 20 * self.R1.random_sample()
            self.geometryparams[i, 1] = 10 + 20 * self.R2.random_sample()
            self.geometryparams[i, 2] = self.R3.choice([-1, 1])
            self.geometryparams[i, 3] = self.R4.choice([-1, 1])

    def calculate_blade_geometry(self, blade, height):
        """Calculates the x and y coordinates for a given height of grass blade.

        Args:
            blade (int): Numeric ID of grass blade.
            height (float): Height of grass blade.

        Returns:
            x, y (float): x and y coordinates of grass blade.
        """

        x = self.geometryparams[blade, 2] * (height / self.geometryparams[blade, 0]) * (height / self.geometryparams[blade, 0])
        y = self.geometryparams[blade, 3] * (height / self.geometryparams[blade, 1]) * (height / self.geometryparams[blade, 1])
        x = round_value(x)

        y = round_value(y)