Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
se2aa4_cs2me3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
W. Spencer Smith
se2aa4_cs2me3
Commits
8cf00d93
Commit
8cf00d93
authored
7 years ago
by
Sepehr Bayat
Browse files
Options
Downloads
Patches
Plain Diff
Delete Triangle.py
parent
21a9c6c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tutorials/T04-A2Example/src/Triangle.py
+0
-73
0 additions, 73 deletions
Tutorials/T04-A2Example/src/Triangle.py
with
0 additions
and
73 deletions
Tutorials/T04-A2Example/src/Triangle.py
deleted
100644 → 0
+
0
−
73
View file @
21a9c6c1
## @file Triangle.py
# @author Sepehr
# @brief Provides the Triangle CLass for Perimeter Area and existence of triangle
# @date 25 Jan 2018
from
PointADT
import
*
##@brief An ADT that respresents a 2D point
class
Triangle
:
## @brief Triangle constructor
# @details Initializes a Triangle with three points a,b,c
# @param a center of triangle
# @param b center of triangle
# @param c center of triangle
def
__init__
(
self
,
p1
,
p2
,
p3
):
self
.
__a
=
p1
self
.
__b
=
p2
self
.
__c
=
p3
## @brief Gets the center_a
# @return The point of type pointT
def
point_a
(
self
):
return
self
.
__a
## @brief Gets the center_a
# @return The point of type pointT
def
point_b
(
self
):
return
self
.
__b
## @brief Gets the center_a
# @return The point of type pointT
def
point_c
(
self
):
return
self
.
__c
## @brief Gets the sides
# @return The sides of the triangle
def
sides
(
self
):
AB
=
pointT
.
dist
(
self
.
point_a
(),
self
.
point_b
())
AC
=
pointT
.
dist
(
self
.
point_a
(),
self
.
point_c
())
BC
=
pointT
.
dist
(
self
.
point_b
(),
self
.
point_c
())
return
[
AB
,
AC
,
BC
]
## @brief Inequality theorem
# @return the existence of a triangle
def
inequality_theorem
(
self
):
AB
,
AC
,
BC
=
self
.
sides
()
if
(
AB
+
AC
>
BC
and
AB
+
BC
>
AC
and
AC
+
BC
>
AB
):
return
True
;
else
:
return
False
;
## @brief perimeter
# @return the perimeter of the triangle
def
perimeter_of_triangle
(
self
):
AB
,
AC
,
BC
=
self
.
sides
()
return
AB
+
AC
+
BC
## @brief area
# @return the area of the triangle
def
area_of_triangle
(
self
):
AB
,
AC
,
BC
=
self
.
sides
()
P
=
(
AB
+
AC
+
BC
)
/
2
return
sqrt
(
P
*
(
P
-
AB
)
*
(
P
-
AC
)
*
(
P
-
BC
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment