Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
51c74e08
Commit
51c74e08
authored
Nov 27, 2020
by
Benedikt Kleinmeier
Browse files
In "VRectangle.shape()", use camel case notation and use boolean variables to communicate intuition
parent
2f0acade
Pipeline
#371811
passed with stages
in 130 minutes and 28 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereUtils/src/org/vadere/util/geometry/shapes/VRectangle.java
View file @
51c74e08
...
...
@@ -45,13 +45,14 @@ public class VRectangle extends Rectangle2D.Double implements VShape {
@Override
public
boolean
contains
(
VCircle
otherShape
)
{
double
x_c
=
otherShape
.
getCentroid
().
x
;
double
y_c
=
otherShape
.
getCentroid
().
y
;
double
r_c
=
otherShape
.
getRadius
();
return
((
this
.
x
+
r_c
)
<
x_c
)
&&
// x < (x_c - r_c)
((
this
.
y
+
r_c
)
<
y_c
)
&&
// y < (y_c - r_c)
((
this
.
x
+
this
.
width
)
>
(
x_c
+
r_c
))
&&
((
this
.
y
+
this
.
height
)
>
(
y_c
+
r_c
));
double
centerX
=
otherShape
.
getCentroid
().
x
;
double
centerY
=
otherShape
.
getCentroid
().
y
;
double
radius
=
otherShape
.
getRadius
();
boolean
circleFitsIntoHorizontally
=
(
centerX
>
(
this
.
x
+
radius
))
&&
((
this
.
x
+
this
.
width
)
>
(
centerX
+
radius
));
boolean
circleFitsIntoVertically
=
(
centerY
>
(
this
.
y
+
radius
))
&&
((
this
.
y
+
this
.
height
)
>
(
centerY
+
radius
));
return
circleFitsIntoHorizontally
&&
circleFitsIntoVertically
;
}
@Override
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment