Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cefdemo
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
谢旭
cefdemo
Commits
a98e7e3a
Commit
a98e7e3a
authored
Jul 01, 2020
by
谢旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加圆柱体距离计算
parent
b339e451
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
7 deletions
+86
-7
storage.ide
.vs/CefDemo/v15/Server/sqlite3/storage.ide
+0
-0
storage.ide-wal
.vs/CefDemo/v15/Server/sqlite3/storage.ide-wal
+0
-0
CalculateModel.cs
CefDemo/Extension/CalculateModel.cs
+86
-7
No files found.
.vs/CefDemo/v15/Server/sqlite3/storage.ide
View file @
a98e7e3a
No preview for this file type
.vs/CefDemo/v15/Server/sqlite3/storage.ide-wal
View file @
a98e7e3a
No preview for this file type
CefDemo/Extension/CalculateModel.cs
View file @
a98e7e3a
...
@@ -24,34 +24,113 @@ namespace CefDemo.Extension
...
@@ -24,34 +24,113 @@ namespace CefDemo.Extension
class
CalculateModel
class
CalculateModel
{
{
public
static
string
DistanceTo
()
{
return
""
;
}
/// <summary>
/// <summary>
///
计算
///
圆柱体电子围栏
/// </summary>
/// </summary>
/// <param name="Center"></param>
/// <param name="Center"></param>
圆心
/// <param name="Radius"></param>
/// <param name="Radius"></param>
半径
/// <param name="point"></param>
/// <param name="point"></param>
/// <returns>返回当前状态</returns>
/// <param name="Height"></param> 围栏高度
/// <param name="Buffer_dis"></param> 缓冲距离
/// <returns></returns>
public
static
string
DistanceToCylinder
(
Point
Center
,
double
Radius
,
Point
point
,
double
Height
,
double
Buffer_dis
)
public
static
string
DistanceToCylinder
(
Point
Center
,
double
Radius
,
Point
point
,
double
Height
,
double
Buffer_dis
)
{
{
// 内圆半径
// 内圆半径
double
_hor_inner_radius
=
0.0
;
_hor_inner_radius
=
Radius
-
Buffer_dis
;
//投影到平面计算, 点与圆心的距离
//投影到平面计算, 点与圆心的距离
double
_distance
=
P2PDistance
(
point
,
Center
);
double
_distance
=
P2PDistance
(
point
,
Center
);
//如果投影再内,再判断高度是否超出
//如果投影再内,再判断高度是否超出
if
(
_distance
<
R
adius
)
if
(
_distance
>
_hor_inner_r
adius
)
{
{
//在内圆,安全
if
(
point
.
Z
<=
Height
-
Buffer_dis
)
{
return
"在缓冲区内"
;
}
else
if
(
point
.
Z
>=
Height
-
Buffer_dis
&&
point
.
Z
<
Height
)
{
return
$"超出缓冲区
{
point
.
Z
-
(
Height
-
Buffer_dis
)}
米"
;
}
else
if
(
point
.
Z
>=
Height
)
{
return
$"超出缓冲区
{
point
.
Z
-
(
Height
-
Buffer_dis
)}
米,超出电子围栏
{
point
.
Z
-
Height
}
米"
;
}
}
else
if
(
_distance
<=
_hor_inner_radius
&&
_distance
<
Radius
)
{
//出了内圆 在外圆内
double
_dis
=
Radius
-
_distance
;
//计算高度状况
double
_dis_height
=
point
.
Z
-
(
Height
-
Buffer_dis
);
double
_dis_Height
=
point
.
Z
-
Height
;
if
(
_dis_height
<
0
)
{
//高度没有超过
return
$"距离电子围栏
{
_dis
}
米"
;
}
else
if
(
_dis_Height
<
0
&&
_dis_height
>=
0
)
{
//缓冲区内
if
(
_dis
>=
Height
-
point
.
Z
)
{
return
$"距离电子围栏
{
Height
-
point
.
Z
}
米"
;
}
}
else
else
{
{
return
$"距离电子围栏
{
_dis
}
米"
;
}
}
else
if
(
_dis_Height
>=
0
)
{
return
$"距离电子围栏
{
point
.
Z
-
Height
}
米"
;
}
return
$"超出缓冲区
{
_dis
}
米"
;
}
else
if
(
_distance
>=
Radius
)
{
//出了外圆
double
_dis_R
=
_distance
-
Radius
;
double
_dis_Height
=
point
.
Z
-
Height
;
if
(
_dis_Height
>=
0
)
{
if
(
_dis_Height
>=
_dis_R
)
{
return
$"超出电子围栏
{
_dis_R
}
米"
;
}
else
{
return
$"超出电子围栏
{
_dis_Height
}
米"
;
}
}
else
{
return
$"超出电子围栏
{
_dis_R
}
米"
;
}
}
}
return
""
;
return
""
;
}
}
public
static
double
P2PDistance
(
Point
A
,
Point
B
)
public
static
double
P2PDistance
(
Point
A
,
Point
B
)
...
...
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