Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
CurvedLines
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
CurvedLines
Commits
3c5463a0
Commit
3c5463a0
authored
Jan 04, 2013
by
MichaelZinsmaier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the saddle issue (hopefully as it should be)
parent
2c887a41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
curvedLines.js
curvedLines.js
+17
-14
No files found.
curvedLines.js
View file @
3c5463a0
...
@@ -196,7 +196,7 @@
...
@@ -196,7 +196,7 @@
//insert a point before and after the "real" data point to force the line
//insert a point before and after the "real" data point to force the line
//to have a max,min at the data point however only if it is a lowest or highest point of the
//to have a max,min at the data point however only if it is a lowest or highest point of the
//curve => avoid saddles
//curve => avoid saddles
var
neigh
=
curvedLinesOptions
.
fitPointDist
;
var
fpDist
=
curvedLinesOptions
.
fitPointDist
;
for
(
var
i
=
0
;
i
<
points
.
length
;
i
+=
ps
)
{
for
(
var
i
=
0
;
i
<
points
.
length
;
i
+=
ps
)
{
...
@@ -205,25 +205,28 @@
...
@@ -205,25 +205,28 @@
curX
=
i
;
curX
=
i
;
curY
=
i
+
yPos
;
curY
=
i
+
yPos
;
//smooth front
//add point to front
front
[
X
]
=
points
[
curX
]
-
0.1
;
front
[
X
]
=
points
[
curX
]
-
fpDist
;
front
[
Y
]
=
points
[
curY
];
//add point to back
back
[
X
]
=
points
[
curX
]
+
fpDist
;
back
[
Y
]
=
points
[
curY
];
//get points (front and back) Y value for saddle test
var
frontPointY
=
points
[
curY
];
var
backPointY
=
points
[
curY
];
if
(
i
>=
ps
)
{
if
(
i
>=
ps
)
{
front
[
Y
]
=
points
[
curY
-
ps
]
*
neigh
+
points
[
curY
]
*
(
1
-
neigh
);
frontPointY
=
points
[
curY
-
ps
];
}
else
{
front
[
Y
]
=
points
[
curY
];
}
}
//smooth back
back
[
X
]
=
points
[
curX
]
+
0.1
;
if
((
i
+
ps
)
<
points
.
length
)
{
if
((
i
+
ps
)
<
points
.
length
)
{
back
[
Y
]
=
points
[
curY
+
ps
]
*
neigh
+
points
[
curY
]
*
(
1
-
neigh
);
backPointY
=
points
[
curY
+
ps
];
}
else
{
back
[
Y
]
=
points
[
curY
];
}
}
//test for a saddle
//test for a saddle
if
((
front
[
Y
]
<=
points
[
curY
]
&&
back
[
Y
]
<=
points
[
curY
])
||
//max or partial horizontal
if
((
front
PointY
<=
points
[
curY
]
&&
backPointY
<=
points
[
curY
])
||
//max or partial horizontal
(
front
[
Y
]
>=
points
[
curY
]
&&
back
[
Y
]
>=
points
[
curY
]))
{
//min or partial horizontal
(
front
PointY
>=
points
[
curY
]
&&
backPointY
>=
points
[
curY
]))
{
//min or partial horizontal
//add curve points
//add curve points
xdata
[
j
]
=
front
[
X
];
xdata
[
j
]
=
front
[
X
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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