From 62a55369aa23d4b9cee5e66e0520b3803c33de6f Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期一, 21 六月 2021 13:29:37 +0800 Subject: [PATCH] 1. 新增走航检测污染溯源模型逻辑 --- src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt index 4a61f24..41a58f4 100644 --- a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt +++ b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt @@ -1,6 +1,8 @@ package com.flightfeather.uav.model.epw import com.flightfeather.uav.model.BaseWeight +import kotlin.math.abs +import kotlin.math.sqrt /** * 椋庨�熻窛绂绘潈閲� @@ -12,7 +14,14 @@ override val weights: List<Double> = listOf(1.0, 0.8, 0.6, 0.5, 0.3, 0.0) fun getWeight(dis: Double, ws: Double): Double { - val value = dis / ws / 60 + val value = dis / 1000 / ws / 60 return weightCal(value) } + + fun getWeight(p1: Pair<Double, Double>, p2: Pair<Double, Double>, ws: Double): Double { + val dx = p2.first - p1.first + val dy = p2.second - p1.second + val dis = sqrt(abs(dx * dx) + abs(dy * dy)) * 100 + return getWeight(dis, ws) + } } \ No newline at end of file -- Gitblit v1.9.3