Surface

class hotwing_core.Surface(coordinates=[])[source]

A Surface is a list of Coordinates that when connected together by lines make up the shape of the surface. A Surface is used to define the top or bottom surfaces of an airfoil.

Parameters:coordinates (Coordinate[]) – list of Coordinates ASSUMED TO BE IN EITHER ASCENDING OR DESCENDING ORDER BASED ON X VALUES
Variables:coordinates – list of Coordinates that make up surface
__add__(other)[source]

Add a Surface object and a Coordinate object

__eq__(other)[source]

Compare two a Surface objects

__getitem__(key)[source]

Trim a surface using the slice functionality.

Ex: surface_obj[2:5], trims from 2 to 5

__mul__(other)[source]

Multiply a Surface object and a number together

__ne__(other)[source]

Compare two a Surface objects

__sub__(other)[source]

Subtract a Surface object and a Coordinate object

interpolate(x)[source]

Interpolate a point on the surface for a given value of X.

Method uses linear interpolation between two points. If the point lies outside of the coordinates, the line is interpolated based on the closest two points extended outwards.

Parameters:x (Float) – Value of x where we want to interpolate
Returns:Coordinate containing original x value provided and solved y value
Return type:Coordinate
interpolate_around_profile_dist(pos)[source]

Find the x-y position along the surface of the profile at a specified DISTANCE around the surface of the profile, starting from the left-most coordinate.

Parameters:pos – (Float): Distance around surface, expressed in units, to find
Returns:Interpolated coordinate at position
Return type:Coordinate
interpolate_around_profile_dist_pct(pct)[source]

Find the x-y position along the surface of the profile at a specified PERCENTAGE value of the total distance around the surface of the profile, starting from the left-most coordinate.

Parameters:pct (Float) – Distance around surface, expressed as a percent, to find
Returns:Interpolated coordinate at position
Return type:Coordinate
classmethod interpolate_new_surface(s1, s2, dist_between, dist_interp, points=200)[source]

Create a new Surface interpolated from two other Surfaces.

Parameters:
  • s1 (Surface) – First Surface to interpolate from
  • s2 (Surface) – Second Surface to interpolate from
  • dist_between (Float) – Distance between profiles
  • dist_interp (Float) – Distance from s1 where new surface should be interpolated
  • points (Int) – Number of points to use for interpolating the new surface
Returns:

New Surface interpolated from s1 and s2

Return type:

Surface

classmethod offset_around_surface(surface, offset)[source]

Offset the surface around the current surface.

Evaluates the relative angle of each Coordinate with relation to the Coordinates on either side of it and moves the each Coordinate along its relative angle. By moving each of the Surface’s Coordinates this way the Survace is expanded/contracted in a way that accurately accounts for a sheeting allowance.

If the ends of the Surface are more horizontal than vertical, the surface will become narrower.

Parameters:
  • surface (Surface) – Surface to offset
  • offset (Float) – Distance to offset from surface - positive value offsets upwards, negative value offsets downwards.
Returns:

new Surface object with the offset applied

Return type:

Surface

classmethod rotate(origin, surface, angle)[source]

Rotate a surface around a point.

Parameters:
  • origin (Coordinate) – Object that defines the point to rotate surface around
  • surface (Surface) – Object to rotate
  • angle (Float) – Degrees to rotate surface.
Returns:

New rotated Surface

Return type:

Surface

classmethod scale(surface, scale)[source]

Scale a Surface by a specified value

Parameters:
  • surface (Surface) – Surface to offset
  • scale (Float) – Scale value
Returns:

new scaled Surface

Return type:

Surface

to_file(output_file, separator='\t', newline='\n')[source]

Write the Surface’s list of Coordinates to a file

Parameters:
  • output_file (String) – Path to file output will be written to
  • separator (String) – Separator between data fields
  • newline (String) – Newline operator
Returns:

None

classmethod translate(surface, offset)[source]

Offset the surface (up, down, left, right) using a Coordinate’s x and y values

Parameters:
  • surface (Surface) – Surface object to offset
  • offset (Coordinate) – Coordinate object containing the x and y offset amounts.
Returns:

new Surface with the offset applied

Return type:

Surface

classmethod trim(surface, x_min=None, x_max=None)[source]

Trim a Surface to new starting and ending x values.

IMPORTANT - If you specify a value smaller than the min or larger than the max, by default those values will be interpolated and may actually make the width of the surface larger.

Parameters:
  • surface (Surface) – Surface object to trim
  • x_min (Float) – X value to make the left cut on - if not specified, no cut will be made on this side
  • x_max (Float) – X value to make the right cut on - if not specified, no cut will be made on this side
Returns:

new Surface trimmed to the min and max x values

Return type:

Surface

bounds

Get the bounding box of the Surface

Returns:Tuple of Coordinates with the min xy and the max xy value
Return type:(Coordinate,Coordinate)
left

Get the left most Coordinate

Returns:left-most Coordinate
Return type:Coordinate
length

Calculate the total length around the area of the surface

Returns:Length around the surface
Return type:Float
right

Get the right-most Coordinate

Returns:right-most Coordinate
Return type:Coordinate