Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EXO2_TP3_ALGO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
AREZKI Celia
EXO2_TP3_ALGO
Commits
3c147b0f
Commit
3c147b0f
authored
8 months ago
by
AREZKI Celia
Browse files
Options
Downloads
Patches
Plain Diff
fix of circle class some changes
parent
f396f51c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/shape/Circle.java
+7
-9
7 additions, 9 deletions
src/main/java/shape/Circle.java
src/main/java/shape/Rectangle.java
+1
-3
1 addition, 3 deletions
src/main/java/shape/Rectangle.java
with
8 additions
and
12 deletions
src/main/java/shape/Circle.java
+
7
−
9
View file @
3c147b0f
package
shape
;
import
javafx.geometry.Point2D
;
import
javafx.scene.canvas.GraphicsContext
;
import
javafx.scene.paint.Color
;
public
class
Circle
implements
Shape
{
private
Point2D
center
;
private
double
radius
;
private
Color
color
;
public
Circle
(
Color
color
,
double
x
,
double
y
,
double
radius
)
{
this
.
color
=
color
;
public
Circle
(
double
x
,
double
y
,
double
radius
)
{
this
.
center
=
new
Point2D
(
x
,
y
);
this
.
radius
=
radius
;
}
@Override
public
int
pointsCount
()
{
return
1
;
}
@Override
public
Point2D
point
(
int
index
)
{
if
(
index
==
0
)
{
return
center
;
}
else
{
throw
new
IndexOutOfBoundsException
(
"Un cercle n'a qu'un seul point central."
);
}
throw
new
IndexOutOfBoundsException
(
"Circle has only one center point."
);
}
@Override
public
void
draw
(
GraphicsContext
context
)
{
context
.
setStroke
(
color
);
context
.
strokeOval
(
center
.
getX
()
-
radius
,
center
.
getY
()
-
radius
,
radius
*
2
,
radius
*
2
);
context
.
strokeOval
(
center
.
getX
()
-
radius
,
center
.
getY
()
-
radius
,
radius
*
2
,
radius
*
2
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/shape/Rectangle.java
+
1
−
3
View file @
3c147b0f
...
...
@@ -16,13 +16,11 @@ public class Rectangle implements Shape {
@Override
public
int
pointsCount
()
{
return
0
;
return
2
;
// Un rectangle est défini par deux points
}
@Override
public
Point2D
point
(
int
index
)
{
return
null
;
if
(
index
==
0
)
{
return
point0
;
}
else
if
(
index
==
1
)
{
...
...
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