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
b075e178
Commit
b075e178
authored
Sep 23, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change functions _checkIntersection
parent
d4873ad7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
251 additions
and
218 deletions
+251
-218
common/Charts/ChartsDrawer.js
common/Charts/ChartsDrawer.js
+251
-218
No files found.
common/Charts/ChartsDrawer.js
View file @
b075e178
...
...
@@ -4286,11 +4286,12 @@ drawAreaChart.prototype =
this
.
chartProp
=
chartsDrawer
.
calcProp
;
this
.
cChartDrawer
=
chartsDrawer
;
this
.
cChartSpace
=
chartsDrawer
.
cChartSpace
;
console
.
time
(
"
asd
"
);
if
(
this
.
cChartDrawer
.
nDimensionCount
===
3
)
this
.
_DrawBars3D
();
else
this
.
_drawLines
();
console
.
timeEnd
(
"
asd
"
);
},
reCalculate
:
function
(
chartsDrawer
)
...
...
@@ -4446,7 +4447,7 @@ drawAreaChart.prototype =
}
},
_calculateAllIntersection
()
_calculateAllIntersection
2
()
{
var
allPoints
=
this
.
points
;
var
prevPoints
;
...
...
@@ -4616,7 +4617,7 @@ drawAreaChart.prototype =
return
res
;
},
_checkIntersection
:
function
(
curRect
,
pointIndex
,
seria
)
_checkIntersection
2
:
function
(
curRect
,
pointIndex
,
seria
)
{
var
curPoint1
=
curRect
.
point1
;
var
curPoint2
=
curRect
.
point2
;
...
...
@@ -5011,7 +5012,12 @@ drawAreaChart.prototype =
var
DiffGapDepth
=
perspectiveDepth
*
(
gapDepth
/
2
)
/
100
;
var
gapDepth
=
this
.
chartProp
.
subType
===
"
normal
"
?
(
perspectiveDepth
+
DiffGapDepth
+
DiffGapDepth
)
*
seria
+
DiffGapDepth
:
DiffGapDepth
;
var
path
,
pxToMm
=
this
.
chartProp
.
pxToMM
,
t
=
this
,
paths
=
[];
var
pathH
=
this
.
chartProp
.
pathH
;
var
pathW
=
this
.
chartProp
.
pathW
;
var
gdLst
=
[];
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
//for define VisibleVerge, as in bar charts
var
p1
=
arrNotRotatePoints
[
0
];
...
...
@@ -5041,19 +5047,6 @@ drawAreaChart.prototype =
var
point77
=
arrPoints
[
6
];
var
point88
=
arrPoints
[
7
];
if
(
!
((
point1
.
y
>
point5
.
y
&&
point4
.
y
>
point8
.
y
)
||
(
point1
.
y
<
point5
.
y
&&
point4
.
y
<
point8
.
y
)))
{
//var parseVerge = t._getPrevSeriesIntersection(0, pointsIn3D);
//return paths;
}
var
path
,
pxToMm
=
this
.
chartProp
.
pxToMM
,
t
=
this
,
paths
=
[];
var
pathH
=
this
.
chartProp
.
pathH
;
var
pathW
=
this
.
chartProp
.
pathW
;
var
gdLst
=
[];
gdLst
[
"
w
"
]
=
1
;
gdLst
[
"
h
"
]
=
1
;
var
generateFace
=
function
(
p11
,
p22
,
p33
,
p44
,
p111
,
p222
,
p333
,
p444
,
p1111
,
p2222
,
p3333
,
p4444
,
faceIndex
,
ser
)
{
if
(
ser
===
undefined
)
...
...
@@ -5085,37 +5078,6 @@ drawAreaChart.prototype =
return
{
seria
:
ser
,
point
:
0
,
verge
:
faceIndex
,
paths
:
path
,
points
:
arrPoints2
,
points2
:
arrPoints
,
plainEquation
:
plainEquation
,
plainArea
:
plainArea
,
arrPointsNotRotate
:
arrPointsNotRotate
,
midY
:
midY
};
};
var
breakFace
=
function
(
index
,
props
)
{
var
face
=
t
.
upFaces
[
index
];
var
p1
=
face
.
points2
[
0
];
var
p2
=
face
.
points2
[
1
];
var
p3
=
props
.
farProject
;
var
p4
=
props
.
nearProject
;
var
p11
=
face
.
points
[
0
];
var
p22
=
face
.
points
[
1
];
var
p33
=
props
.
far
;
var
p44
=
props
.
near
;
var
face1
=
generateFace
(
p1
,
p2
,
p3
,
p4
,
p11
,
p22
,
p33
,
p44
,
face
.
faceIndex
,
face
.
seria
);
var
p1
=
props
.
nearProject
;
var
p2
=
props
.
farProject
;
var
p3
=
face
.
points2
[
2
];
var
p4
=
face
.
points2
[
3
];
var
p11
=
props
.
near
;
var
p22
=
props
.
far
;
var
p33
=
face
.
points
[
2
];
var
p44
=
face
.
points
[
3
];
var
face2
=
generateFace
(
p1
,
p2
,
p3
,
p4
,
p11
,
p22
,
p33
,
p44
,
face
.
faceIndex
,
face
.
seria
);
t
.
upFaces
.
splice
(
index
,
1
)
t
.
upFaces
.
push
(
face1
);
t
.
upFaces
.
push
(
face2
);
};
//находим пересечение грани с предыдущими гранями. если есть, что делим грани
this
.
_calculateSimpleRect
(
arrPoints
,
arrPointsProject
,
point
,
seria
);
...
...
@@ -5123,85 +5085,36 @@ drawAreaChart.prototype =
if
(
breakFree
&&
breakFree
.
up
&&
breakFree
.
up
.
length
)
{
for
(
var
i
=
0
;
i
<=
breakFree
.
up
.
length
;
i
++
)
breakFree
.
up
=
breakFree
.
up
.
sort
(
function
sortArr
(
a
,
b
)
{
return
a
.
x
-
b
.
x
;
});
for
(
var
i
=
0
;
i
<
breakFree
.
up
.
length
-
1
;
i
++
)
{
var
prevNear
,
prevFar
,
prevNearProject
,
prevFarProject
,
prevNotRotateNear
,
prevNotRotateFar
;
if
(
i
===
0
)
{
if
(
p1
.
y
>
p5
.
y
)
{
prevNearProject
=
point5
;
prevFarProject
=
point6
;
prevNear
=
point55
;
prevFar
=
point66
;
prevNotRotateNear
=
p5
;
prevNotRotateFar
=
p6
;
}
else
{
prevNearProject
=
point1
;
prevFarProject
=
point2
;
prevNear
=
point11
;
prevFar
=
point22
;
prevNotRotateNear
=
p1
;
prevNotRotateFar
=
p2
;
}
}
else
{
var
prevPoint
=
breakFree
.
up
[
i
-
1
];
prevNearProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
/*+ DiffGapDepth*/
);
prevFarProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
+
perspectiveDepth
);
prevNear
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
/*+ DiffGapDepth*/
,
null
,
null
,
true
);
prevFar
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
+
perspectiveDepth
,
null
,
null
,
true
);
prevNotRotateNear
=
{
x
:
prevPoint
.
x
,
y
:
prevPoint
.
y
,
z
:
gapDepth
};
prevNotRotateFar
=
{
x
:
prevPoint
.
x
,
y
:
prevPoint
.
y
,
z
:
gapDepth
+
perspectiveDepth
};
}
var
prevPoint
=
breakFree
.
up
[
i
];
prevNearProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
/*+ DiffGapDepth*/
);
prevFarProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
+
perspectiveDepth
);
prevNear
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
/*+ DiffGapDepth*/
,
null
,
null
,
true
);
prevFar
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
prevPoint
.
x
,
prevPoint
.
y
,
gapDepth
+
perspectiveDepth
,
null
,
null
,
true
);
prevNotRotateNear
=
{
x
:
prevPoint
.
x
,
y
:
prevPoint
.
y
,
z
:
gapDepth
};
prevNotRotateFar
=
{
x
:
prevPoint
.
x
,
y
:
prevPoint
.
y
,
z
:
gapDepth
+
perspectiveDepth
};
var
near
,
far
,
nearProject
,
farProject
,
notRotateNear
,
notRotateFar
;
if
(
i
===
breakFree
.
up
.
length
)
{
if
(
p4
.
y
>
p8
.
y
)
{
nearProject
=
point8
;
farProject
=
point7
;
near
=
point88
;
far
=
point77
;
notRotateNear
=
p8
;
notRotateFar
=
p7
;
}
else
{
nearProject
=
point4
;
farProject
=
point3
;
near
=
point44
;
far
=
point33
;
notRotateNear
=
p4
;
notRotateFar
=
p3
;
}
}
else
{
var
point
=
breakFree
.
up
[
i
];
nearProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
/*+ DiffGapDepth*/
);
farProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
+
perspectiveDepth
);
near
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
/*+ DiffGapDepth*/
,
null
,
null
,
true
);
far
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
+
perspectiveDepth
,
null
,
null
,
true
);
notRotateNear
=
{
x
:
point
.
x
,
y
:
point
.
y
,
z
:
gapDepth
};
notRotateFar
=
{
x
:
point
.
x
,
y
:
point
.
y
,
z
:
gapDepth
+
perspectiveDepth
};
}
var
point
=
breakFree
.
up
[
i
+
1
];
nearProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
/*+ DiffGapDepth*/
);
farProject
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
+
perspectiveDepth
);
near
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
/*+ DiffGapDepth*/
,
null
,
null
,
true
);
far
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
+
perspectiveDepth
,
null
,
null
,
true
);
notRotateNear
=
{
x
:
point
.
x
,
y
:
point
.
y
,
z
:
gapDepth
};
notRotateFar
=
{
x
:
point
.
x
,
y
:
point
.
y
,
z
:
gapDepth
+
perspectiveDepth
};
var
face1
=
generateFace
(
prevNearProject
,
prevFarProject
,
farProject
,
nearProject
,
prevNear
,
prevFar
,
far
,
near
,
prevNotRotateNear
,
prevNotRotateFar
,
notRotateNear
,
notRotateFar
,
1
);
...
...
@@ -5213,134 +5126,254 @@ drawAreaChart.prototype =
var
face1
=
generateFace
(
point1
,
point2
,
point3
,
point4
,
point11
,
point22
,
point33
,
point44
,
p1
,
p2
,
p3
,
p4
,
1
);
this
.
upFaces
.
push
(
face1
);
}
return
[];
},
_calculateAllIntersection
()
{
var
allPoints
=
this
.
points
;
var
prevPoints
;
var
nullPositionOX
=
this
.
chartProp
.
nullPositionOX
;
var
pxToMm
=
this
.
chartProp
.
pxToMM
;
//сдвиг по OZ в глубину
var
gapDepth
=
this
.
cChartSpace
.
chart
.
plotArea
.
chart
.
gapDepth
!=
null
?
this
.
cChartSpace
.
chart
.
plotArea
.
chart
.
gapDepth
:
globalGapDepth
;
var
perspectiveDepth
=
this
.
cChartDrawer
.
processor3D
.
depthPerspective
;
var
perspectiveDepth
=
this
.
chartProp
.
subType
===
"
normal
"
?
(
perspectiveDepth
/
(
gapDepth
/
100
+
1
))
/
this
.
chartProp
.
seriesCount
:
perspectiveDepth
/
(
gapDepth
/
100
+
1
);
var
DiffGapDepth
=
perspectiveDepth
*
(
gapDepth
/
2
)
/
100
;
var
gapDepth
=
this
.
chartProp
.
subType
===
"
normal
"
?
(
perspectiveDepth
+
DiffGapDepth
+
DiffGapDepth
)
*
seria
+
DiffGapDepth
:
DiffGapDepth
;
if
(
breakFree
&&
breakFree
.
down
&&
breakFree
.
down
.
length
)
for
(
var
seria
=
0
;
seria
<
allPoints
.
length
;
seria
++
)
{
for
(
var
i
=
0
;
i
<
breakFree
.
down
.
length
;
i
++
)
var
points
=
allPoints
[
seria
];
for
(
var
i
=
0
;
i
<
points
.
length
-
1
;
i
++
)
{
var
point
=
breakFree
.
down
[
i
];
var
test1
=
t
.
cChartDrawer
.
_convertAndTurnPoint
(
point
.
x
,
point
.
y
,
gapDepth
/*+ DiffGapDepth*/
);
var
sdf
=
"
asd
"
;
var
x
=
points
[
i
].
x
*
pxToMm
;
var
y
=
points
[
i
].
y
*
pxToMm
;
var
x1
=
points
[
i
+
1
].
x
*
pxToMm
;
var
y1
=
points
[
i
+
1
].
y
*
pxToMm
;
prevPoints
=
this
.
_getPrevSeriesPoints
(
allPoints
,
seria
);
//рассчитываем 8 точек для каждого ректа
var
prevX
=
prevPoints
?
prevPoints
[
i
].
x
*
pxToMm
:
x
;
var
prevY
=
prevPoints
?
prevPoints
[
i
].
y
*
pxToMm
:
nullPositionOX
;
var
prevX1
=
prevPoints
?
prevPoints
[
i
+
1
].
x
*
pxToMm
:
x1
;
var
prevY1
=
prevPoints
?
prevPoints
[
i
+
1
].
y
*
pxToMm
:
nullPositionOX
;
if
(
!
this
.
prevPoints
)
this
.
prevPoints
=
[];
if
(
!
this
.
prevPoints
[
i
])
this
.
prevPoints
[
i
]
=
[];
var
curRect
=
{
point1
:
{
x
:
x
,
y
:
y
,
z
:
gapDepth
}
,
point2
:
{
x
:
x1
,
y
:
y1
,
z
:
gapDepth
}
,
prevPoint1
:
{
x
:
prevX
,
y
:
prevY
,
z
:
gapDepth
},
prevPoint2
:
{
x
:
prevX1
,
y
:
prevY1
,
z
:
gapDepth
}};
this
.
_checkIntersection
(
curRect
,
i
,
seria
);
this
.
prevPoints
[
i
][
seria
]
=
curRect
;
}
}
},
_checkIntersection
:
function
(
curRect
,
pointIndex
,
seriaIndex
)
{
var
t
=
this
;
var
curPoint1
=
curRect
.
point1
;
var
curPoint2
=
curRect
.
point2
;
var
curPoint3
=
curRect
.
prevPoint1
;
var
curPoint4
=
curRect
.
prevPoint2
;
if
(
curPoint1
.
y
>
curPoint3
.
y
)
{
curPoint1
=
curRect
.
prevPoint1
;
curPoint2
=
curRect
.
prevPoint2
;
curPoint3
=
curRect
.
point1
;
curPoint4
=
curRect
.
point2
;
}
var
curLine1
=
this
.
cChartDrawer
.
getLineEquation
(
curPoint1
,
curPoint2
);
var
curLine2
=
this
.
cChartDrawer
.
getLineEquation
(
curPoint3
,
curPoint4
);
var
curTempIntersection
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
curLine1
,
curLine2
);
var
curUp
=
[{
start
:
curPoint1
,
end
:
curPoint2
,
eq
:
curLine1
}];
var
curIntersection
=
null
;
if
(
curTempIntersection
&&
curTempIntersection
.
x
>
curPoint1
.
x
&&
curTempIntersection
.
x
<
curPoint2
.
x
)
{
curIntersection
=
curTempIntersection
;
curUp
[
0
]
=
{
start
:
curPoint1
,
end
:
curIntersection
,
eq
:
curLine1
};
curUp
[
1
]
=
{
start
:
curIntersection
,
end
:
curPoint2
,
eq
:
curLine2
};
}
/*if(point5.y > point1.y && point8.y < point4.y)//грани скрещиваются
var
addToArr
=
function
(
point
,
seria
,
isDown
,
elem
)
{
//в данном случае нижняя грань пересекает верхнюю
//1)рассчитаем крайние точки пересечения верхней и нижней грани
var curDescendingLine = this.cChartDrawer.getLineEquation(point55, point88);
var curAscendingLine = this.cChartDrawer.getLineEquation(point44, point11);
var curIntersectionNear = this.cChartDrawer.isIntersectionLineAndLine(curDescendingLine, curAscendingLine);
if
(
!
t
.
intersections
[
point
])
{
t
.
intersections
[
point
]
=
[];
}
var curDescendingLineFar = this.cChartDrawer.getLineEquation(point66, point77);
var curAscendingLineFar = this.cChartDrawer.getLineEquation(point33, point22);
var curIntersectionFar = this.cChartDrawer.isIntersectionLineAndLine(curDescendingLineFar, curAscendingLineFar);
if
(
!
t
.
intersections
[
point
][
seria
])
{
t
.
intersections
[
point
][
seria
]
=
{};
}
//test
var projectСurIntersectionNear = t.cChartDrawer._convertAndTurnPoint(curIntersectionNear.x, curIntersectionNear.y, curIntersectionNear.z, true, true, null);
var projectСurIntersectionFar = t.cChartDrawer._convertAndTurnPoint(curIntersectionFar.x, curIntersectionFar.y, curIntersectionFar.z, true, true, null);
console.log(projectIntersection);
if
(
isDown
&&
!
t
.
intersections
[
point
][
seria
].
down
)
{
t
.
intersections
[
point
][
seria
].
down
=
[];
}
if
(
!
isDown
&&
!
t
.
intersections
[
point
][
seria
].
up
)
{
t
.
intersections
[
point
][
seria
].
up
=
[];
}
//делим текущие грани
var face1 = generateFace(point1, point2, projectСurIntersectionFar, projectСurIntersectionNear, point11, point22, curIntersectionFar, curIntersectionNear, 1);
var face3 = generateFace(projectСurIntersectionNear, projectСurIntersectionFar, point3, point4, curIntersectionNear, curIntersectionFar, point33, point44, 1);
//var arr = isDown ? t.intersections[point][seria].down : t.intersections[point][seria].up;
t
.
intersections
[
point
][
seria
].
up
.
push
(
elem
);
};
//первая/последняя точка текущей грани, пересечение текущей грани
if
(
!
this
.
prevPoints
[
pointIndex
].
length
||
(
this
.
prevPoints
[
pointIndex
].
length
&&
!
this
.
prevPoints
[
pointIndex
][
seriaIndex
]))
{
//заносим первую точку грани - ПЕРЕПРОВеРИТЬ
addToArr
(
pointIndex
,
seriaIndex
,
null
,
curPoint1
);
var face2 = generateFace(point5, point6, projectСurIntersectionFar, projectСurIntersectionNear, point55, point66, curIntersectionFar, curIntersectionNear, 4);
var face4 = generateFace(projectСurIntersectionNear, projectСurIntersectionFar, point7, point8, curIntersectionNear, curIntersectionFar, point77, point88, 4);
//заносим текущее пересечение
if
(
curIntersection
)
{
addToArr
(
pointIndex
,
seriaIndex
,
null
,
curIntersection
);
//сразу заносим последнюю точку грани
addToArr
(
pointIndex
,
seriaIndex
,
null
,
curPoint4
);
}
else
{
//сразу заносим последнюю точку грани
addToArr
(
pointIndex
,
seriaIndex
,
null
,
curPoint2
);
}
}
if
(
this
.
prevUp
&&
this
.
prevUp
[
pointIndex
])
{
for
(
var
i
=
0
;
i
<
this
.
prevUp
[
pointIndex
].
length
;
i
++
)
{
var
prevUp
=
this
.
prevUp
[
pointIndex
][
i
];
for
(
var
j
=
0
;
j
<
this
.
prevUp
[
pointIndex
][
i
].
length
;
j
++
)
{
for
(
var
k
=
0
;
k
<
curUp
.
length
;
k
++
)
{
var
line1
=
this
.
prevUp
[
pointIndex
][
i
][
j
];
var
line2
=
curUp
[
k
];
var
intersection
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
line1
.
eq
,
line2
.
eq
);
if
(
intersection
)
{
//предыдущая - i
if
(
intersection
.
x
>
line1
.
start
.
x
&&
intersection
.
x
<
line1
.
end
.
x
)
{
addToArr
(
pointIndex
,
i
,
null
,
intersection
);
}
//текущая серия
if
(
intersection
.
x
>
line2
.
start
.
x
&&
intersection
.
x
<
line2
.
end
.
x
)
{
addToArr
(
pointIndex
,
seriaIndex
,
null
,
intersection
);
}
}
}
}
}
}
//смотрим предыдущие серии
for
(
var
i
=
0
;
i
<
this
.
prevPoints
[
pointIndex
].
length
;
i
++
)
{
var
rect
=
this
.
prevPoints
[
pointIndex
][
i
];
var
point1
=
rect
.
point1
;
var
point2
=
rect
.
point2
;
var
point3
=
rect
.
prevPoint1
;
var
point4
=
rect
.
prevPoint2
;
var
line1
=
this
.
cChartDrawer
.
getLineEquation
(
point1
,
point2
);
var
line2
=
this
.
cChartDrawer
.
getLineEquation
(
point3
,
point4
);
this.upFaces.push(face2);
this.upFaces.push(face3);
this.upFaces.push(face4);
var
upCurUpPrev
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
curLine1
,
line1
);
var
upCurDownPrev
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
curLine1
,
line2
);
var
downCurUpPrev
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
curLine2
,
line1
);
var
downCurDownPrev
=
this
.
cChartDrawer
.
isIntersectionLineAndLine
(
curLine2
,
line2
);
//2)рассчитаем крайние точки пересечения нисходящей грани и других верхних граней
var intersectionAnotherFaceNear;
var intersectionAnotherFaceFar;
var distance = null;
var intersectionIndex;
//if(seria === t.cChartDrawer.calcProp.seriesCount - 1)
//{
for(var i = 0; i < this.upFaces.length; i++)
//принадлежит ли данная точка прямой текущей точки
if
(
upCurUpPrev
&&
upCurUpPrev
.
x
>
curPoint1
.
x
&&
upCurUpPrev
.
x
<
curPoint2
.
x
)
{
//прямая разбивается точкой пересечения на две в данном случае
if
(
curIntersection
)
{
if(this.upFaces[i].seria === seria)
{
continue;
}
//ищем точки пересечения и разбиваем грань
var prevLine = this.cChartDrawer.getLineEquation(this.upFaces[i].points[0], this.upFaces[i].points[3]);
var intersectionNear = this.cChartDrawer.isIntersectionLineAndLine(curAscendingLine, prevLine);
var prevLine1 = this.cChartDrawer.getLineEquation(this.upFaces[i].points[1], this.upFaces[i].points[2]);
var intersectionFar = this.cChartDrawer.isIntersectionLineAndLine(curAscendingLineFar, prevLine1);
}
else
{
var curDistance = Math.sqrt(Math.pow(point55.x - intersectionNear.x, 2) + Math.pow(point55.y - intersectionNear.y, 2) + Math.pow(point55.z - intersectionNear.z, 2));
if(null === distance || (null !== distance && curDistance < distance))
{
distance = curDistance;
intersectionAnotherFaceNear = intersectionNear;
intersectionAnotherFaceFar = intersectionFar;
intersectionIndex = i;
var projectIntersection = t.cChartDrawer._convertAndTurnPoint(intersectionNear.x, intersectionNear.y, intersectionNear.z, true, true, null);
}
}
//}
var props = null;
if(intersectionAnotherFaceNear)
}
/*if(upCurUpPrev && upCurUpPrev.x > curPoint1.x && upCurUpPrev.x < curPoint2.x)
{
var intersectionAnotherFaceNearProject = t.cChartDrawer._convertAndTurnPoint(intersectionAnotherFaceNear.x, intersectionAnotherFaceNear.y, intersectionAnotherFaceNear.z, true, true, null);
var intersectionAnotherFaceFarProject = t.cChartDrawer._convertAndTurnPoint(intersectionAnotherFaceFar.x, intersectionAnotherFaceFar.y, intersectionAnotherFaceFar.z, true, true, null);
props = {isUp: true, near: intersectionAnotherFaceNear, far: intersectionAnotherFaceFar, nearProject: intersectionAnotherFaceNearProject, farProject: intersectionAnotherFaceFarProject};
breakFace(intersectionIndex, props);
this.upFaces.push(face1);
breakFace(this.upFaces.length - 1, props);
addToArr(pointIndex, i, null, upCurUpPrev);
addToArr(pointIndex, seriaIndex, null, upCurUpPrev);
}
else
if(upCurDownPrev && upCurDownPrev.x > curPoint1.x && upCurDownPrev.x < curPoint2.x)
{
this.upFaces.push(face1);
addToArr(pointIndex, i, null, upCurDownPrev);
addToArr(pointIndex, seriaIndex, null, upCurDownPrev);
}
//пересечение грани самой себя, нижняя и верхняя грань набивается выше
t._calculatePrismRect([point11, point22, curIntersectionFar, curIntersectionNear, point55, point66, curIntersectionFar, curIntersectionNear], [point1, point2, projectСurIntersectionFar, projectСurIntersectionNear, point5, point6, projectСurIntersectionFar, projectСurIntersectionNear], point, seria, true, props);
t._calculatePrismRect([curIntersectionNear, curIntersectionFar, point33, point44, point77, point88, curIntersectionNear, curIntersectionFar], [projectСurIntersectionNear, projectСurIntersectionFar, point3, point4, point7, point8, projectСurIntersectionNear, projectСurIntersectionFar], point, seria);
if(downCurUpPrev && downCurUpPrev.x > curPoint1.x && downCurUpPrev.x < curPoint2.x)
{
addToArr(pointIndex, i, null, downCurUpPrev);
addToArr(pointIndex, seriaIndex, null, downCurUpPrev);
}
if(downCurDownPrev && downCurDownPrev.x > curPoint1.x && downCurDownPrev.x < curPoint2.x)
{
addToArr(pointIndex, i, null, downCurDownPrev);
addToArr(pointIndex, seriaIndex, null, downCurDownPrev);
}*/
}
else if(point5.y < point1.y && point8.y < point4.y)//верхняя и нижняя грань меняются местами
if
(
!
this
.
prevUp
)
{
var test = "sad";
this
.
prevUp
=
[];
}
if
(
!
this
.
prevUp
[
pointIndex
])
{
this
.
prevUp
[
pointIndex
]
=
[];
}
else
{*/
/*var face1 = generateFace(point1, point2, point3, point4, point11, point22, point33, point44, 1);
var face2 = generateFace(point5, point6, point7, point8, point55, point66, point77, point88, 4);
this.upFaces.push(face1);
this.upFaces.push(face2);*/
//}
//this.usuallyCalculateSeries[seria] = pointsIn3D;
return
[];
},
this
.
prevUp
[
pointIndex
][
seriaIndex
]
=
curUp
;
},
_calculateSimpleRect
(
arrPoints
,
arrPointsProject
,
point
,
seria
,
props
)
{
var
path
,
pxToMm
=
this
.
chartProp
.
pxToMM
,
t
=
this
,
paths
=
[];
...
...
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