Skip to content
Snippets Groups Projects
Commit 23348ab2 authored by Steven Palmer's avatar Steven Palmer
Browse files

Small fixes to T4

parent 0f8cfa51
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -181,43 +181,29 @@ McMaster University\\ }
\section{Example}
\begin{frame}
\frametitle{Example }
Consider implementation of point on two dimensional plane
Consider the implementation of a triangle on a 2-D plane
\begin{itemize}
\item Position P is represented by pair of real numbers (x,y)
\item A point is represented by pair of real numbers (x,y)
\item A triangle is represented by three points
\item Considering we have three points in a 2D surface and we want to know the possibility of having a triangle with the three points and then calculate the perimeter and the area of the triangle.
\item The triangle should be able to determine that it is a valid triangle, calculate its perimeter and calculate its area.
\end{itemize}
\end {frame}
% --------------------------------------------------
% --------------------------------------------------
%\section{Example}
\begin{frame}
Consider the following triangle:
\begin{figure}[h]
\centering
% \includegraphics[width=0.5\textwidth]{triangle.png}
\end{figure}
We are using the following inequality which is called inequality equation to know the possibility of having triangle with three points A, B and C:
\end{frame}
% --------------------------------------------------
% --------------------------------------------------
%\section{Example}
\begin{frame}
\begin{itemize}
\item $$ \mathrm{AB + AC < BC, AC + BC < AB, AB + BC < AC}$$
\end{itemize}
We are using the following inequality to test that the triangle is valid:
$$ \mathrm{AB + AC > BC, AC + BC > AB, AB + BC > AC}$$
We are calculating the perimeter of the triangle using the following formula:
\begin{itemize}
\item $$\mathrm {P = (AB+AC+BC)}$$
\end{itemize}
$$\mathrm {P = (AB+AC+BC)}$$
We are using the Heron formula to calculate the area of the triangle:
\begin {itemize}
\item $$ \mathrm {\sqrt[2]{P/2(P/2-AB)(P/2-AC)(P/2-BC)}}$$
\end{itemize}
$$ \mathrm {\sqrt[2]{P/2(P/2-AB)(P/2-AC)(P/2-BC)}}$$
\end {frame}
......@@ -227,7 +213,7 @@ We are using the Heron formula to calculate the area of the triangle:
\frametitle{Point ADT Module }
\textbf{Template Module}\\
pointADT
PointADT
\newline
\textbf{Uses}\\
......@@ -295,7 +281,7 @@ None
\textbf{Access Routine Semantics}\\
PointT($x, y$):
new PointT($x, y$):
\begin{itemize}
\item transition: $xc, yc := x, y$
\item output: $out := \mathit{self}$
......@@ -379,7 +365,7 @@ PointADT
\textbf{Syntax}\\
Exported Types:
\newline
TriangleADT = ?\\
TriangleT = ?\\
\end{frame}
% --------------------------------------------------
......@@ -395,7 +381,7 @@ TriangleADT = ?\\
%\hline
%init & \multirow{2}{*}{Note 1} & Triangle & \\ \cline{1-3}
\hline
new TriangleT & PointT, PointT, PointT&TriangleADT & ~\\
new TriangleT & PointT, PointT, PointT&TriangleT & ~\\
\hline
sides & & seq[3] of real &~\\
\hline
......@@ -477,7 +463,7 @@ $\wedge (self.sides[0] + self.slide[2]) > self.sides[1]$)
\\ p1.ycoord()==p2.ycoord() ==p3.ycoord()) $\Rightarrow \mbox{LINE})$
\end{itemize}
\noindent area of triangle($ $):
\noindent area\_of\_triangle($ $):
\begin{itemize}
\item output : $out :=$
${\sqrt[2]{P/2(P/2-self.sides[0])(P/2-self.sides[1])(P/2-self.sides[2])}}$
......@@ -510,11 +496,11 @@ From the MIS we can deduce the interface of the code will look like:
#Selectors
def sides(self):
def inequality theorem(self):
def inequality_theorem(self):
def perimeter of triangle(self):
def perimeter_of_triangle(self):
def area of triangle(self):
def area_of_triangle(self):
\end{lstlisting}
......
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