Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.model.Triangle Class Reference
Inheritance diagram for com.example.graphics.model.Triangle:
Inheritance graph
Collaboration diagram for com.example.graphics.model.Triangle:
Collaboration graph

Public Member Functions

 Triangle (int x1, int y1, int x2, int y2, int x3, int y3)
void accept (ShapeVisitor visitor)
Shape clone ()
int getX ()
int getX1 ()
int getX2 ()
int getX3 ()
int getY ()
int getY1 ()
int getY2 ()
int getY3 ()
void setPosition (int x, int y)
void setTriangle (int x1, int y1, int x2, int y2, int x3, int y3)

Private Attributes

int x1
int x2
int x3
int y1
int y2
int y3

Detailed Description

Triangle implementation of the Shape interface.

Definition at line 8 of file Triangle.java.

Constructor & Destructor Documentation

◆ Triangle()

com.example.graphics.model.Triangle.Triangle ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3 )
inline

Constructs a triangle with the specified vertices

Parameters
x1the x coordinate of the first vertex
y1the y coordinate of the first vertex
x2the x coordinate of the second vertex
y2the y coordinate of the second vertex
x3the x coordinate of the third vertex
y3the y coordinate of the third vertex

Definition at line 25 of file Triangle.java.

References x1, x2, x3, y1, y2, and y3.

Referenced by clone().

Here is the caller graph for this function:

Member Function Documentation

◆ accept()

void com.example.graphics.model.Triangle.accept ( ShapeVisitor visitor)
inline

Accept method for the Visitor pattern

Parameters
visitorthe visitor to accept

Implements com.example.graphics.model.Shape.

Definition at line 131 of file Triangle.java.

◆ clone()

Shape com.example.graphics.model.Triangle.clone ( )
inline

Clone the shape

Returns
a clone of this shape

Implements com.example.graphics.model.Shape.

Definition at line 136 of file Triangle.java.

References Triangle(), x1, x2, x3, y1, y2, and y3.

Here is the call graph for this function:

◆ getX()

int com.example.graphics.model.Triangle.getX ( )
inline

Get the x coordinate of the shape

Returns
x coordinate

Implements com.example.graphics.model.Shape.

Definition at line 35 of file Triangle.java.

References x1.

Referenced by setPosition().

Here is the caller graph for this function:

◆ getX1()

◆ getX2()

◆ getX3()

◆ getY()

int com.example.graphics.model.Triangle.getY ( )
inline

Get the y coordinate of the shape

Returns
y coordinate

Implements com.example.graphics.model.Shape.

Definition at line 42 of file Triangle.java.

References y1.

Referenced by setPosition().

Here is the caller graph for this function:

◆ getY1()

◆ getY2()

◆ getY3()

◆ setPosition()

void com.example.graphics.model.Triangle.setPosition ( int x,
int y )
inline

Set the position of the shape

Parameters
xthe x coordinate
ythe y coordinate

Implements com.example.graphics.model.Shape.

Definition at line 50 of file Triangle.java.

References getX(), getY(), x1, x2, x3, y1, y2, and y3.

Here is the call graph for this function:

◆ setTriangle()

void com.example.graphics.model.Triangle.setTriangle ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3 )
inline

Set all three vertices of the triangle at once

Parameters
x1the x coordinate of the first vertex
y1the y coordinate of the first vertex
x2the x coordinate of the second vertex
y2the y coordinate of the second vertex
x3the x coordinate of the third vertex
y3the y coordinate of the third vertex

Definition at line 121 of file Triangle.java.

References x1, x2, x3, y1, y2, and y3.

Member Data Documentation

◆ x1

int com.example.graphics.model.Triangle.x1
private

Definition at line 9 of file Triangle.java.

Referenced by Triangle(), clone(), getX(), getX1(), setPosition(), and setTriangle().

◆ x2

int com.example.graphics.model.Triangle.x2
private

Definition at line 11 of file Triangle.java.

Referenced by Triangle(), clone(), getX2(), setPosition(), and setTriangle().

◆ x3

int com.example.graphics.model.Triangle.x3
private

Definition at line 13 of file Triangle.java.

Referenced by Triangle(), clone(), getX3(), setPosition(), and setTriangle().

◆ y1

int com.example.graphics.model.Triangle.y1
private

Definition at line 10 of file Triangle.java.

Referenced by Triangle(), clone(), getY(), getY1(), setPosition(), and setTriangle().

◆ y2

int com.example.graphics.model.Triangle.y2
private

Definition at line 12 of file Triangle.java.

Referenced by Triangle(), clone(), getY2(), setPosition(), and setTriangle().

◆ y3

int com.example.graphics.model.Triangle.y3
private

Definition at line 14 of file Triangle.java.

Referenced by Triangle(), clone(), getY3(), setPosition(), and setTriangle().


The documentation for this class was generated from the following file: