Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ronan
coraMaths
Commits
8d02d73c
Commit
8d02d73c
authored
Jun 05, 2016
by
ronan
Browse files
Add constructor setter Circle Rectangle
parent
433de40e
Pipeline
#2257
passed with stage
in 53 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cora/cora-maths/1.0/cora-maths-1.0-javadoc.jar
View file @
8d02d73c
No preview for this file type
cora/cora-maths/1.0/cora-maths-1.0-sources.jar
View file @
8d02d73c
No preview for this file type
cora/cora-maths/1.0/cora-maths-1.0.jar
View file @
8d02d73c
No preview for this file type
src/main/java/org/cora/maths/Circle.java
View file @
8d02d73c
...
...
@@ -23,6 +23,13 @@ public class Circle extends RoundForm
orientation
.
setPos
(
center
);
}
public
Circle
(
float
x
,
float
y
,
float
radius
)
{
super
();
this
.
radius
=
radius
;
orientation
.
setPos
(
x
,
y
);
}
public
Circle
(
float
radius
)
{
super
();
...
...
@@ -36,6 +43,24 @@ public class Circle extends RoundForm
orientation
.
setPos
(
circle
.
getCenter
());
}
public
void
set
(
Circle
circle
)
{
this
.
radius
=
circle
.
getRadius
();
orientation
.
setPos
(
circle
.
getCenter
());
}
public
void
set
(
Vector2D
center
,
float
radius
)
{
this
.
radius
=
radius
;
orientation
.
setPos
(
center
);
}
public
void
set
(
float
x
,
float
y
,
float
radius
)
{
this
.
radius
=
radius
;
orientation
.
setPos
(
x
,
y
);
}
@Override
public
Object
clone
()
{
...
...
src/main/java/org/cora/maths/Rectangle.java
View file @
8d02d73c
...
...
@@ -42,9 +42,8 @@ public class Rectangle extends Form
}
/**
*
* @param center center of the rectangle
* @param length
* @param length
rec size
* @param omega angle of the rectangle
*/
public
Rectangle
(
Vector2D
center
,
Vector2D
length
,
float
omega
)
...
...
@@ -53,7 +52,50 @@ public class Rectangle extends Form
this
.
length
=
new
Vector2D
();
set
(
center
,
length
,
omega
);
}
/**
* @param x center of the rectangle
* @param y center of the rectangle
* @param width rec size
* @param height rec size
* @param omega angle of the rectangle
*/
public
Rectangle
(
float
x
,
float
y
,
float
width
,
float
height
,
float
omega
)
{
super
(
4
);
this
.
length
=
new
Vector2D
();
set
(
x
,
y
,
width
,
height
,
omega
);
}
/**
* @param center center of the rectangle
* @param length rec size
*/
public
Rectangle
(
Vector2D
center
,
Vector2D
length
)
{
super
(
4
);
this
.
length
=
new
Vector2D
();
set
(
center
,
length
,
omega
);
}
/**
* @param x center of the rectangle
* @param y center of the rectangle
* @param width rec size
* @param height rec size
*/
public
Rectangle
(
float
x
,
float
y
,
float
width
,
float
height
)
{
super
(
4
);
this
.
length
=
new
Vector2D
();
set
(
x
,
y
,
width
,
height
);
}
/**
* @param center center of the rectangle
* @param length rec size
* @param omega angle of the rectangle
*/
public
void
set
(
Vector2D
center
,
Vector2D
length
,
float
omega
)
{
this
.
clearTransformations
();
...
...
@@ -67,6 +109,47 @@ public class Rectangle extends Form
this
.
rotateRadians
(
omega
,
center
);
}
/**
* @param x center of the rectangle
* @param y center of the rectangle
* @param width rec size
* @param height rec size
* @param omega angle of the rectangle
*/
public
void
set
(
float
x
,
float
y
,
float
width
,
float
height
,
float
omega
)
{
set
(
new
Vector2D
(
x
,
y
),
new
Vector2D
(
width
,
height
),
omega
);
}
/**
* @param center center of the rectangle
* @param length rec size
*/
public
void
set
(
Vector2D
center
,
Vector2D
length
)
{
this
.
clearTransformations
();
orientation
.
setPos
(
center
);
this
.
length
.
set
(
length
);
points
.
get
(
0
).
set
(-
0.5f
*
length
.
x
,-
0.5f
*
length
.
y
);
points
.
get
(
1
).
set
(-
0.5f
*
length
.
x
,+
0.5f
*
length
.
y
);
points
.
get
(
2
).
set
(+
0.5f
*
length
.
x
,+
0.5f
*
length
.
y
);
points
.
get
(
3
).
set
(+
0.5f
*
length
.
x
,-
0.5f
*
length
.
y
);
}
/**
* @param x center of the rectangle
* @param y center of the rectangle
* @param width rec size
* @param height rec size
*/
public
void
set
(
float
x
,
float
y
,
float
width
,
float
height
)
{
set
(
new
Vector2D
(
x
,
y
),
new
Vector2D
(
width
,
height
));
}
public
void
set
(
Rectangle
rec
)
{
this
.
set
(
rec
.
getCenter
(),
rec
.
getLength
(),
rec
.
getAngle
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment