Safe HaskellNone

Physics

Synopsis

Documentation

g :: Float #

Acceleration due to gravity

gAcceleration :: Point #

Acceleration due to gravity in two dimensions

unitTime :: Float #

A single unit of time for motion

restVelocity :: Point #

To denote zero velocity in two dimensions

originPosition #

Arguments

:: Float

The x coordinate

-> Float

The y coordinate

-> Point

The equivalent point

Function to accept two floats and return a point corresponding to them

newPosition :: Point -> Point -> Point -> Float -> Point #

Function to obtain the new position in two dimensions given the position, velocity, acceleration, and time based on Newton's second kinematic equation

newVelocity :: Point -> Point -> Float -> Point #

Function to obtain the new velocity in two dimensions given the velocity, acceleration, and time based on Newton's first kinematic equation

newOneDPosition :: Float -> Float -> Float -> Float -> Float #

Function to obtain the new position in one dimension given the position, velocity, acceleration, and time based on Newton's second kinematic equation

newOneDVelocity :: Float -> Float -> Float -> Float #

Function to obtain the new velocity in one dimenstion given the velocity, acceleration, and time based on Newton's first kinematic equation

cosComponent :: Float -> Float -> Float #

Function to give the cosine component of a given quantity with respect to an angle theta

sinComponent :: Float -> Float -> Float #

Function to give the sine component of a given quantity with respect to an angle theta

getComponentsVelocity :: Float -> Float -> Point #

Function to return the components of the velocity in two dimensions given angle and magnitude

gravityNewPosition :: Point -> Point -> Float -> Point #

Function to accept a two dimensional position and velocity, and time, and return the new position under the influence of gravity

newPositionVTheta :: Point -> Point -> Float -> Float -> Point #

Function to return the new position in two dimensions given the position, magnitude of velocity, angle, and acceleration in the first dimenstion, with the acceleration in the other direction taken to be that of gravity and time taken to be the unit time

gravityNewPositionFromRest :: Point -> Float -> Point #

Function to return the new position in two dimensions given position and time under gravity when starting from rest

getNewPositionUnderGravity :: Point -> Float -> Float -> Float -> Point #

Function to return the new position given the position, time, magnitude of velocity and angle under gravity

newPositionGravityFrame :: Point -> Float -> Float -> Point #

Function to return position which would be after unit time

constantVelocityNewPosition :: Point -> Float -> Float -> Point #

Function to return the new position given position, magnitude of velocity and angle in unit time under no acceleration

getIsObstacle :: [[Tile]] -> Float -> Float -> Bool #

Function to accept tile matrix, row, column and return if the corresponding tile has an obstacle or not

getTilePos :: [[Tile]] -> Float -> Float -> Point #

Function to return the point corresponding to a given row and column of a tile matrix after checking for validity

getTilePosX :: [[Tile]] -> Float -> Float -> Float #

Function to return the x coordinate of the point corresponding to a given row and column of a tile matrix after checking for validity

getTilePosY :: [[Tile]] -> Float -> Float -> Float #

Function to return the y coordinate of the point corresponding to a given row and column of a tile matrix after checking for validity

getPositionX :: Point -> Float #

Function to return the x coordinate of a point

getPositionY :: Point -> Float #

Function to return the y coordinate of a point

getAngleProjectile :: Float -> Float -> Direction -> Float #

Function to return the angle of a projectile given magnitude of velocity and current angle for change in unit time

getPositionProjectile :: Point -> Float -> Float -> Point #

Function to return the new position of a projectile given position, magnitude of velocity and current angle for change in unit time

getVelocityProjectile :: Float -> Float -> Float #

Function to return the magnitude of velocity of a projectile given magnitude of velocity and current angle for change in unit time

getLineSlopeIntercept :: Point -> Point -> (Float, Float) #

Function to accept two points and return its slope and intercept

checkOrientationPointLine :: Point -> Point -> Point -> PointLineOrientation #

Function to accept a point, and two end points of a line, and check the points orientation with respect to the line

checkPointInRectangle :: Point -> Point -> Integer -> Integer -> Float -> Bool #

Function to accept a point, the bottom left vertex of a rectangle, length, width, angle of inclination and return whether the point lies in the rectangle or not

checkPointInCircle :: Point -> Point -> Float -> Bool #

Function to accept a point, the centre of a circle, and radius, and return if the point lies in the circle or not

getListOfPointsInCircle :: Point -> Float -> [[Point]] -> [Point] #

Function to accept the center and radius of a circle, and the bounding square of the circle and return the list of points in it

getAllPointsInCircle :: Point -> Float -> [Point] #

Function to accept the center and radius of a circle and return the list of points in it

checkCommonPointsCircleLine :: Point -> Float -> [Point] -> [Point] #

Function to accept the centre and radius of a circle and a list of points and return a list of common points

getListOfPointsInLine :: Point -> Integer -> [Point] #

Function to accept the left vertex and length of a horizontal line and return the list of points in it

getListOfPointsInRectangle :: Point -> Integer -> Integer -> [[Point]] #

Function to accept the bottom left vertex, length, and width of a horizontal rectangle and return a list of lists of points in it

flattenList :: [[t]] -> [t] #

Function to accept a two dimensional list and returna one dimensional list

commonPointsBetweenLists :: [(Integer, Integer)] -> [(Integer, Integer)] -> [(Integer, Integer)] #

Function to accept two lists of Integer tuples and return a list of common points

convertPointListToInteger :: [Point] -> [(Integer, Integer)] #

Function to accept a list of points and return a corresponding list of Integer tuples

commonPointsBetweenCircleRectangle :: Point -> Float -> Point -> Float -> Float -> [(Integer, Integer)] #

Function to return a list of common points between a circle and a rectangle

getOtherEndPoint :: Point -> Integer -> Float -> Point #

checkLineIfObstacle :: Point -> Point -> Integer -> Float -> Integer -> [[Tile]] -> Bool #

Function to help check if a given line contains a point with an obstacle in it

checkLineSegmentObstacle :: Point -> Integer -> Float -> [[Tile]] -> Bool #

Function to check if a given line contains a point with an obstacle in it

thetaIncrement :: Float #

The increment of theta for finding the angle of inclination of the tank

thetaMax :: Float #

The maximum possible angle

searchForAngle :: Point -> Integer -> Integer -> Float -> Float -> [[Tile]] -> Float #

Function to find the minimum valid angle of inclination of a given rectangle

getAngleAt :: Point -> Integer -> Integer -> [[Tile]] -> Float #

Function that accepts left end point of line and length of tank, and returns angle of its inclination

checkObstacleInCircle :: Point -> Float -> [[Tile]] -> Bool #

Function that accepts the centre and radius of a circle, tile map, and checks if it contains any obstacle in it or not

checkObstacleInList :: [Point] -> [[Tile]] -> Bool #

Function that accepts a list of points and tile map and returns if any of them contain an obstacle or not

radianTodegree :: Float -> Float #

Function to convert an angle from radians to degrees

edgeOfTriangle :: Float #

To fix the edge length of the triangle marker

rectHalfAngle :: Float #

The angle of inclination of the top mid point of a rectangle with respect to the bottom left vertex

hypotenuseRect :: Float #

The distance between the top center point and the left bottom vertex of a rectangle

makeTileNotObsAtPts :: [[Tile]] -> [Point] -> [[Tile]] #

Function to accept a list of points and the tile matrix and remove the obstacle property at those points

changeListElementAtIndex :: [a] -> Int -> a -> [a] #

Function to change the value of an element of a list at a given index

getAllPointsInLine :: Point -> Integer -> Float -> Integer -> [Point] #

Function to return a list of all points in a line

getAllPointsInRectangleHelper :: Point -> Integer -> Integer -> Float -> Integer -> [[Point]] #

Function to help get a list of all points in a given rectangle

getAllPointsInRectangle :: Point -> Integer -> Integer -> Float -> [Point] #

Function to return the list of all points in a given rectangle

checkIfNotValidPosition :: Point -> Integer -> Integer -> Float -> [[Tile]] -> Bool #

Function that checks whether a given position and orientation of a rectangle is free from obstacles or not

tankGravityNewPosition :: Point -> Integer -> Integer -> Float -> [[Tile]] -> Point #

Function to return the new position of a tank under the influence of gravity

parabolaFunction :: Point -> Float -> Float -> Float -> Float #

Function to calculate the y coordinate of a given x coordinate value for an object in projectile motion

checkIntermediateObstacleInPath :: GameState -> Point -> Point -> Point -> Float -> Float -> [[Tile]] -> Bool -> Point #

Function to check if the path between two points has any obstacle in it so that weapons don't overshoot tanks or mountains in a unit time

getPointFromYChecks :: GameState -> Float -> Float -> Float -> Bool -> [[Tile]] -> Point #

Function to check the path for obstacles when the object is moving in a vertical line, where the parabola function fails as theta will be pi/2

newPositionProjectile :: GameState -> Point -> Point -> Float -> Float -> Float -> Float -> [[Tile]] -> Point #

Function to return the new position of a projectile taking into account obstacles in its path

getTurretPosition :: GameState -> Float -> Point #

Function to get the position of the tip of the turret from which the weapon was shot

checkAllTanksForHitHelper :: GameState -> Point -> Int -> Bool #

Function to help check if any tank has been hit by a weapon

checkAllTanksForHit :: GameState -> Point -> Bool #

Function to check if any tank has been hit by a weapon

minValid :: Float #

The minimum allowed angle for a tank

maxValid :: Float #

The maximum allowed angle for a tank

checkThetaValidRange :: Float -> Bool #

Function to check if a given angle is in the valid range or not