类 Triangle
java.lang.Object
com.example.graphics.model.Triangle
- 所有已实现的接口:
Shape
Triangle implementation of the Shape interface.
-
字段概要
字段 -
构造器概要
构造器构造器说明Triangle
(int x1, int y1, int x2, int y2, int x3, int y3) Constructs a triangle with the specified vertices -
方法概要
修饰符和类型方法说明void
accept
(ShapeVisitor visitor) Accept method for the Visitor patternclone()
Clone the shapeint
getX()
Get the x coordinate of the shapeint
getX1()
Get the x coordinate of the first vertexint
getX2()
Get the x coordinate of the second vertexint
getX3()
Get the x coordinate of the third vertexint
getY()
Get the y coordinate of the shapeint
getY1()
Get the y coordinate of the first vertexint
getY2()
Get the y coordinate of the second vertexint
getY3()
Get the y coordinate of the third vertexvoid
setPosition
(int x, int y) Set the position of the shapevoid
setTriangle
(int x1, int y1, int x2, int y2, int x3, int y3) Set all three vertices of the triangle at once
-
字段详细资料
-
x1
private int x1 -
y1
private int y1 -
x2
private int x2 -
y2
private int y2 -
x3
private int x3 -
y3
private int y3
-
-
构造器详细资料
-
Triangle
public Triangle(int x1, int y1, int x2, int y2, int x3, int y3) Constructs a triangle with the specified vertices- 参数:
x1
- the x coordinate of the first vertexy1
- the y coordinate of the first vertexx2
- the x coordinate of the second vertexy2
- the y coordinate of the second vertexx3
- the x coordinate of the third vertexy3
- the y coordinate of the third vertex
-
-
方法详细资料
-
getX
public int getX()从接口复制的说明:Shape
Get the x coordinate of the shape -
getY
public int getY()从接口复制的说明:Shape
Get the y coordinate of the shape -
setPosition
public void setPosition(int x, int y) 从接口复制的说明:Shape
Set the position of the shape- 指定者:
setPosition
在接口中Shape
- 参数:
x
- the x coordinatey
- the y coordinate
-
getX1
public int getX1()Get the x coordinate of the first vertex- 返回:
- the x1 coordinate
-
getY1
public int getY1()Get the y coordinate of the first vertex- 返回:
- the y1 coordinate
-
getX2
public int getX2()Get the x coordinate of the second vertex- 返回:
- the x2 coordinate
-
getY2
public int getY2()Get the y coordinate of the second vertex- 返回:
- the y2 coordinate
-
getX3
public int getX3()Get the x coordinate of the third vertex- 返回:
- the x3 coordinate
-
getY3
public int getY3()Get the y coordinate of the third vertex- 返回:
- the y3 coordinate
-
setTriangle
public void setTriangle(int x1, int y1, int x2, int y2, int x3, int y3) Set all three vertices of the triangle at once- 参数:
x1
- the x coordinate of the first vertexy1
- the y coordinate of the first vertexx2
- the x coordinate of the second vertexy2
- the y coordinate of the second vertexx3
- the x coordinate of the third vertexy3
- the y coordinate of the third vertex
-
accept
从接口复制的说明:Shape
Accept method for the Visitor pattern -
clone
从接口复制的说明:Shape
Clone the shape
-