Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sphere
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIERRON Laurent
sphere
Commits
b1fa800d
Commit
b1fa800d
authored
2 years ago
by
PIERRON Laurent
Browse files
Options
Downloads
Patches
Plain Diff
Correction de computeVolume() mise au cube au lieu du carré. Respect des indications SonarLint.
parent
dd694a9e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/nancy/iut/Sphere.java
+14
-14
14 additions, 14 deletions
src/main/java/fr/nancy/iut/Sphere.java
with
14 additions
and
14 deletions
src/main/java/fr/nancy/iut/Sphere.java
+
14
−
14
View file @
b1fa800d
...
@@ -10,53 +10,53 @@ public class Sphere {
...
@@ -10,53 +10,53 @@ public class Sphere {
// Constructors
// Constructors
// ***********************************************************************
// ***********************************************************************
public
Sphere
()
{
public
Sphere
()
{
radius
_
=
0.0
;
radius
Protected
=
0.0
;
pos
_
=
new
Point3d
();
pos
Protected
=
new
Point3d
();
}
}
public
Sphere
(
double
radius
)
{
public
Sphere
(
double
radius
)
{
radius
_
=
radius
;
radius
Protected
=
radius
;
pos
_
=
new
Point3d
();
pos
Protected
=
new
Point3d
();
}
}
public
Sphere
(
double
radius
,
Point3d
pos
)
{
public
Sphere
(
double
radius
,
Point3d
pos
)
{
radius
_
=
radius
;
radius
Protected
=
radius
;
pos
_
=
pos
;
pos
Protected
=
pos
;
}
}
// ***********************************************************************
// ***********************************************************************
// Methods
// Methods
// ***********************************************************************
// ***********************************************************************
public
double
computeVolume
()
{
public
double
computeVolume
()
{
return
4
*
Math
.
PI
*
Math
.
pow
(
radius
_
,
2
)
/
3
;
return
4
*
Math
.
PI
*
Math
.
pow
(
radius
Protected
,
3
)
/
3
;
}
}
public
double
distanceTo
(
Sphere
other
)
{
public
double
distanceTo
(
Sphere
other
)
{
return
pos
_
.
distance
(
other
.
pos
_
);
return
pos
Protected
.
distance
(
other
.
pos
Protected
);
}
}
public
double
distanceSquaredTo
(
Sphere
other
)
{
public
double
distanceSquaredTo
(
Sphere
other
)
{
return
pos
_
.
distanceSquared
(
other
.
pos
_
);
return
pos
Protected
.
distanceSquared
(
other
.
pos
Protected
);
}
}
public
boolean
inContactWith
(
Sphere
other
)
{
public
boolean
inContactWith
(
Sphere
other
)
{
return
distanceSquaredTo
(
other
)
<=
Math
.
pow
(
radius
_
+
other
.
radius
_
,
2
);
return
distanceSquaredTo
(
other
)
<=
Math
.
pow
(
radius
Protected
+
other
.
radius
Protected
,
2
);
}
}
// ***********************************************************************
// ***********************************************************************
// Accessors
// Accessors
// ***********************************************************************
// ***********************************************************************
public
Point3d
getPos
()
{
public
Point3d
getPos
()
{
return
pos
_
;
return
pos
Protected
;
}
}
public
double
getRadius
()
{
public
double
getRadius
()
{
return
radius
_
;
return
radius
Protected
;
}
}
// ***********************************************************************
// ***********************************************************************
// Attributes
// Attributes
// ***********************************************************************
// ***********************************************************************
protected
double
radius
_
=
0.0
;
protected
double
radius
Protected
=
0.0
;
protected
Point3d
pos
_
;
protected
Point3d
pos
Protected
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment