Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
3724a17e
Commit
3724a17e
authored
Dec 24, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ previous rev.
parent
6179e1d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
130 deletions
+77
-130
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+77
-130
No files found.
common/Charts/ChartsDrawer.js
View file @
3724a17e
...
...
@@ -2733,6 +2733,15 @@ CChartsDrawer.prototype =
return
res
;
},
isPointLieIntoPlane
:
function
(
planeEquation
,
point
)
{
var
bRes
=
false
;
bRes
=
!!
(
planeEquation
.
a
*
point
.
x
+
planeEquation
.
b
*
point
.
y
+
planeEquation
.
c
*
point
.
z
+
planeEquation
.
d
==
0
);
return
bRes
;
},
isPointsLieIntoOnePlane
:
function
(
point1
,
point2
,
point3
,
point4
)
{
var
bRes
=
false
;
...
...
@@ -10950,6 +10959,15 @@ drawSurfaceChart.prototype =
var
xPoints
=
this
.
cChartSpace
.
chart
.
plotArea
.
catAx
.
xPoints
;
var
perspectiveDepth
=
this
.
cChartDrawer
.
processor3D
.
depthPerspective
;
if
(
!
this
.
paths
.
test
)
{
this
.
paths
.
test
=
[];
}
if
(
!
this
.
paths
.
test2
)
{
this
.
paths
.
test2
=
[];
}
var
getGridPlain
=
function
(
index
)
{
var
gridX1
=
xPoints
[
0
].
pos
*
t
.
chartProp
.
pxToMM
;
...
...
@@ -10978,18 +10996,9 @@ drawSurfaceChart.prototype =
return
res
;
};
var
getIntersectionPlane
sAndLines
=
function
(
lines
,
pointsValue
)
var
getIntersectionPlane
AndLines
=
function
(
k
,
lines
,
pointsValue
)
{
var
minVal
=
Math
.
min
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
,
pointsValue
[
3
].
val
);
var
maxVal
=
Math
.
max
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
,
pointsValue
[
3
].
val
);
//находим пересечение даннного сегмента с плоскостями сетки
for
(
var
k
=
0
;
k
<
yPoints
.
length
;
k
++
)
{
if
(
!
(
yPoints
[
k
].
val
>=
minVal
&&
yPoints
[
k
].
val
<=
maxVal
))
{
continue
;
}
var
res
=
null
;
var
gridPlain
=
getGridPlain
(
k
);
var
clearIntersectionPoints
=
[];
...
...
@@ -11022,12 +11031,7 @@ drawSurfaceChart.prototype =
var
p1
=
clearIntersectionPoints
[
0
];
var
p2
=
clearIntersectionPoints
[
1
];
if
(
!
t
.
paths
.
test2
[
k
])
{
t
.
paths
.
test2
[
k
]
=
[];
}
t
.
paths
.
test2
[
k
].
push
(
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
));
res
=
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
);
}
if
(
clearIntersectionPoints
.
length
>
2
)
...
...
@@ -11042,103 +11046,46 @@ drawSurfaceChart.prototype =
var
p1
=
segmentIntersectionPoints
[
0
];
var
p2
=
clearIntersectionPoints
[
0
];
if
(
!
t
.
paths
.
test2
[
k
])
{
t
.
paths
.
test2
[
k
]
=
[];
}
t
.
paths
.
test2
[
k
].
push
(
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
));
res
=
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
);
}
}
}
};
var
getIntersectionPlanesAndLines2
=
function
(
lines
,
pointsValue
)
{
var
minVal
=
Math
.
min
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
);
var
maxVal
=
Math
.
max
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
);
//находим пересечение даннного сегмента с плоскостями сетки
for
(
var
k
=
0
;
k
<
yPoints
.
length
;
k
++
)
{
if
(
!
(
yPoints
[
k
].
val
>=
minVal
&&
yPoints
[
k
].
val
<=
maxVal
))
{
continue
;
}
var
gridPlain
=
getGridPlain
(
k
);
var
clearIntersectionPoints
=
[];
var
segmentIntersectionPoints
=
[];
var
diagonalIntersection
=
null
;
return
res
;
};
//n --> lines --> 0 - down, 1 - up, 2 - left, 3 - right, 4 - diagonal
for
(
var
n
=
0
;
n
<
lines
.
length
;
n
++
)
var
getIntersectionPlanesAndLines
=
function
(
lines
,
pointsValue
)
{
var
convertResult
=
t
.
cChartDrawer
.
isIntersectionPlainAndLineSegment
(
gridPlain
,
lines
[
n
].
p1
,
lines
[
n
].
p2
,
lines
[
n
].
p111
,
lines
[
n
].
p222
);
if
(
!
convertResult
)
continue
;
if
(
null
===
isEqualPoints
(
pointsValue
,
convertResult
))
var
minVal
;
var
maxVal
;
if
(
pointsValue
.
length
===
4
)
{
clearIntersectionPoints
.
push
(
convertResult
);
minVal
=
Math
.
min
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
,
pointsValue
[
3
].
val
);
maxVal
=
Math
.
max
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
,
pointsValue
[
3
].
val
);
}
else
{
if
(
null
===
isEqualPoints
(
segmentIntersectionPoints
,
convertResult
))
{
segmentIntersectionPoints
.
push
(
convertResult
);
}
}
minVal
=
Math
.
min
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
);
maxVal
=
Math
.
max
(
pointsValue
[
0
].
val
,
pointsValue
[
1
].
val
,
pointsValue
[
2
].
val
);
}
if
(
!
segmentIntersectionPoints
.
length
)
{
//две точки, не равняющиеся ни одной точке сегмента, проходящие через диагональ
if
(
clearIntersectionPoints
.
length
===
2
)
//две точки, не равняющиеся ни одной точке сегмента
//находим пересечение даннного сегмента с плоскостями сетки
for
(
var
k
=
0
;
k
<
yPoints
.
length
;
k
++
)
{
var
p1
=
clearIntersectionPoints
[
0
];
var
p2
=
clearIntersectionPoints
[
1
];
if
(
!
t
.
paths
.
test2
[
k
])
if
(
!
(
yPoints
[
k
].
val
>=
minVal
&&
yPoints
[
k
].
val
<=
maxVal
))
{
t
.
paths
.
test2
[
k
]
=
[];
}
t
.
paths
.
test2
[
k
].
push
(
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
))
continue
;
}
if
(
clearIntersectionPoints
.
length
>
2
)
{
console
.
log
(
"
SOS
"
);
}
}
else
if
(
segmentIntersectionPoints
.
length
&&
clearIntersectionPoints
.
length
)
{
if
(
1
===
segmentIntersectionPoints
.
length
&&
1
===
clearIntersectionPoints
.
length
)
{
var
p1
=
segmentIntersectionPoints
[
0
];
var
p2
=
clearIntersectionPoints
[
0
];
var
path
=
getIntersectionPlaneAndLines
(
k
,
lines
,
pointsValue
);
if
(
!
t
.
paths
.
test2
[
k
])
{
t
.
paths
.
test2
[
k
]
=
[];
}
t
.
paths
.
test2
[
k
].
push
(
t
.
_calculatePath
(
p1
.
x
,
p1
.
y
,
p2
.
x
,
p2
.
y
));
}
}
t
.
paths
.
test2
[
k
].
push
(
path
);
}
};
if
(
!
this
.
paths
.
test
)
{
this
.
paths
.
test
=
[];
}
if
(
!
this
.
paths
.
test2
)
{
this
.
paths
.
test2
=
[];
}
for
(
var
i
=
0
;
i
<
points
.
length
-
1
;
i
++
)
{
...
...
@@ -11214,8 +11161,8 @@ drawSurfaceChart.prototype =
var
lines2
=
[
lines
[
4
],
lines
[
1
],
lines
[
3
]];
var
pointsValue2
=
[
p1
,
p21
,
p2
];
}
getIntersectionPlanesAndLines
2
(
lines1
,
pointsValue1
);
getIntersectionPlanesAndLines
2
(
lines2
,
pointsValue2
);
getIntersectionPlanesAndLines
(
lines1
,
pointsValue1
);
getIntersectionPlanesAndLines
(
lines2
,
pointsValue2
);
}
}
}
...
...
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