Skip to content
Snippets Groups Projects
Commit 93411736 authored by Sepehr Bayat's avatar Sepehr Bayat
Browse files

Delete PointMassADT.py

parent 6d1e82ef
No related branches found
No related tags found
No related merge requests found
## @file pointADT.py
# @author Gurankash Singh
# @brief Provides the PointMass ADT class for representing point masses
# @date 30 Jan 2017
from PointADT import *
##@brief An ADT that respresents a 2D point
class pointMassT:
UNIVERSAL_G = 6.672e-11
## @brief PointMassT constructor
# @details Initializes a PointMassT object with a point and corresponding mass value
# @param p The coordinates of the point type pointT
# @param m The mass value
def __init__(self, p, m):
self.__pt = p
self.__ms = m
## @brief Gets the coordinates of the point
# @return The point of type pointT
def point(self):
return self.__pt
## @brief Gets the mass the point
# @return The the mass value
def mval(self):
return self.__ms
## @brief Determines the force between 2 point masses
# @details Uses the force formula with UniversalG constant
# @param p Another point mass
# @return The force between the given point masses
def force(self, p):
m = self.__ms * p.mval()
r = dist(self.__pt, point(p))
return UNIVERSAL_G * m / (r ** 2)
## @brief Determines the force vector between the 2 point masses
# @details Uses the force vector formula
# @param p Another point mass
# @return The force vector
def Fx(self, p):
xDist = point(p).xcoord() - self.__pt.xcoord()
r = dist(self.__pt, point(p))
return self.__force(p) * (xDist/r)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment