Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibLaserCut
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Elektronikföreningen Admittansen
LibLaserCut
Commits
6713da56
Commit
6713da56
authored
12 years ago
by
Max Gaukler
Browse files
Options
Downloads
Patches
Plain Diff
Revert "add public Interval class"
This reverts commit
4992a846
.
parent
4992a846
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/com/t_oster/liblasercut/platform/Interval.java
+0
-69
0 additions, 69 deletions
src/com/t_oster/liblasercut/platform/Interval.java
src/com/t_oster/liblasercut/platform/Rectangle.java
+25
-2
25 additions, 2 deletions
src/com/t_oster/liblasercut/platform/Rectangle.java
with
25 additions
and
71 deletions
src/com/t_oster/liblasercut/platform/Interval.java
deleted
100644 → 0
+
0
−
69
View file @
4992a846
/**
* This file is part of VisiCut.
* Copyright (C) 2012 Max Gaukler <development@maxgaukler.de>
*
* VisiCut is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VisiCut is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with VisiCut. If not, see <http://www.gnu.org/licenses/>.
**/
package
com.t_oster.liblasercut.platform
;
/**
* Integer interval
*/
public
class
Interval
{
private
int
min
,
max
;
public
Interval
(
int
a
,
int
b
)
{
this
.
min
=
Math
.
min
(
a
,
b
);
this
.
max
=
Math
.
max
(
a
,
b
);
}
public
int
getMin
()
{
return
this
.
min
;
}
public
int
getMax
()
{
return
this
.
max
;
}
/**
* check if this interval is subset of another one (or equal)
* @param other Interval
* @return true if this is a subset of other, or equal to it
*/
public
boolean
isSubsetOf
(
Interval
other
)
{
return
((
other
.
getMin
()
<=
this
.
getMin
())
&&
(
other
.
getMax
()
>=
this
.
getMax
()));
}
public
boolean
isSupersetOf
(
Interval
other
)
{
return
other
.
isSubsetOf
(
this
);
}
/**
* test if value is inside interval
* @param x
* @return true if value is inside [min, max] (borders included)
*/
public
boolean
contains
(
int
x
)
{
return
((
this
.
getMin
()
<=
x
)
&&
(
this
.
getMax
()
>=
x
));
}
/**
* check if the intervals intersect
* @param other
* @return true if the intervals share at least one common value
*/
public
boolean
intersects
(
Interval
other
)
{
return
this
.
contains
(
other
.
getMin
())
||
this
.
contains
(
other
.
getMax
())
||
this
.
isSubsetOf
(
other
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/com/t_oster/liblasercut/platform/Rectangle.java
+
25
−
2
View file @
6713da56
...
...
@@ -26,6 +26,29 @@ package com.t_oster.liblasercut.platform;
public
class
Rectangle
{
private
int
x1
,
x2
,
y1
,
y2
;
private
class
Interval
{
private
int
x1
,
x2
;
private
Interval
(
int
x1
,
int
x2
)
{
this
.
x1
=
x1
;
this
.
x2
=
x2
;
}
private
boolean
isSubsetOf
(
Interval
o
)
{
return
o
.
x1
<=
x1
&&
o
.
x2
>=
x2
;
}
private
boolean
intersects
(
Interval
o
)
{
return
(
o
.
x1
>=
x1
&&
o
.
x1
<=
x2
)
||
(
o
.
x2
>=
x1
&&
o
.
x2
<=
x2
);
}
}
/**
* construct a rectangle with the corners (x1,y1) and (x2,y2)
*/
...
...
@@ -108,14 +131,14 @@ public class Rectangle {
/**
* X interval from left to right
*/
p
ublic
Interval
getXInterval
()
{
p
rivate
Interval
getXInterval
()
{
return
new
Interval
(
x1
,
x2
);
}
/**
* Y interval from top to bottom
*/
p
ublic
Interval
getYInterval
()
{
p
rivate
Interval
getYInterval
()
{
return
new
Interval
(
y1
,
y2
);
}
...
...
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