Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CI320
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
Harbor Registry
Model registry
Operate
Environments
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
Wellington Gabriel Vicente de Souza
CI320
Commits
0cc4258e
Commit
0cc4258e
authored
6 years ago
by
Wellington Gabriel Vicente de Souza
Browse files
Options
Downloads
Patches
Plain Diff
[T3] tidy up code and change file name
parent
6b3a07e1
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
T3/index.html
+0
-0
0 additions, 0 deletions
T3/index.html
T3/lines.js
+1
-22
1 addition, 22 deletions
T3/lines.js
with
1 addition
and
22 deletions
T3/
l
in
es
.html
→
T3/in
dex
.html
+
0
−
0
View file @
0cc4258e
File moved
This diff is collapsed.
Click to expand it.
T3/lines.js
+
1
−
22
View file @
0cc4258e
...
...
@@ -79,12 +79,6 @@ function handleMouseUp() {
draggingSecondEnd
=
false
;
}
function
distance
(
x0
,
y0
,
xf
,
yf
)
{
power2X
=
Math
.
pow
(
x0
-
xf
,
2
);
power2Y
=
Math
.
pow
(
y0
-
yf
,
2
);
return
Math
.
sqrt
(
power2X
+
power2Y
);
}
function
dragLine
()
{
if
(
selectedLine
!=
null
)
{
if
(
movingEntireLine
)
{
...
...
@@ -146,11 +140,6 @@ function dragLine() {
}
}
function
isOnLine
(
x0
,
y0
,
xf
,
yf
,
px
,
py
)
{
var
f
=
function
(
somex
)
{
return
(
yf
-
y0
)
/
(
xf
-
x0
)
*
(
somex
-
x0
)
+
y0
;
};
return
Math
.
abs
(
f
(
px
)
-
py
)
<
20
&&
px
>=
x0
&&
px
<=
xf
;
}
function
handleMouse
()
{
if
(
mouseDown
&&
selectedLine
==
null
)
{
for
(
var
i
=
lines
.
length
-
1
;
i
>=
0
;
i
--
)
{
...
...
@@ -172,16 +161,7 @@ function handleMouse() {
}
}
else
if
(
rightClick
)
{
for
(
var
i
=
lines
.
length
-
1
;
i
>=
0
;
i
--
)
{
// distanceMouseX0 = distance(mouseX,mouseY,lines[i].x0,lines[i].y0);
// distanceMouseXF = distance(mouseX,mouseY,lines[i].xf,lines[i].yf);
// distanceX0XF = distance(lines[i].x0,lines[i].y0,lines[i].xf,lines[i].yf);
// console.log(distanceMouseX0,distanceMouseXF,distanceX0XF);
// if ((distanceMouseX0 + distanceMouseXF >= distanceX0XF - 20) && (distanceMouseX0 + distanceMouseXF <= distanceX0XF + 20)) {
//console.log("isOnLine: ", isOnLine(lines[i].x0,lines[i].y0,lines[i].xf,lines[i].yf,mouseX,mouseY));
var
mouseOnLine
=
isOnLine
(
lines
[
i
].
x0
,
lines
[
i
].
y0
,
lines
[
i
].
xf
,
lines
[
i
].
yf
,
mouseX
,
mouseY
)
||
isOnLine
(
lines
[
i
].
xf
,
lines
[
i
].
yf
,
lines
[
i
].
x0
,
lines
[
i
].
y0
,
mouseX
,
mouseY
);
console
.
log
(
mouseOnLine
);
if
(
mouseOnLine
)
{
if
((
mouseY
>=
lines
[
i
].
y0
&&
mouseY
<=
lines
[
i
].
yf
)
||
(
mouseY
>=
lines
[
i
].
yf
&&
mouseY
<=
lines
[
i
].
y0
))
{
if
(
mouseX
>=
lines
[
i
].
x0
&&
mouseX
<=
lines
[
i
].
xf
)
{
lines
[
lines
.
length
]
=
new
Line
(
mouseX
,
mouseY
,
lines
[
i
].
xf
,
lines
[
i
].
yf
);
lines
[
i
].
xf
=
mouseX
;
...
...
@@ -221,7 +201,6 @@ function generatePolygon() {
var
tmpxf
=
300
*
Math
.
cos
(
angle
)
+
centerX
;
var
tmpyf
=
300
*
Math
.
sin
(
angle
)
+
centerY
;
lines
[
i
]
=
new
Line
(
tmpx0
,
tmpy0
,
tmpxf
,
tmpyf
);
console
.
log
(
lines
[
i
]);
tmpx0
=
tmpxf
;
tmpy0
=
tmpyf
;
}
...
...
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