[add][fix] added distance func to Cell and fixed missing import in library

This commit is contained in:
2020-01-29 01:19:11 -06:00
parent 7f6614fbc2
commit 4073a93f44
2 changed files with 7 additions and 1 deletions

View File

@@ -102,7 +102,11 @@ case class SensorResult() extends Result[(Group, Cell, Option[Double])]
case class SensorID(group: Group, Id: Int) case class SensorID(group: Group, Id: Int)
case class Duration(simDuration: Int) case class Duration(simDuration: Int)
case class TickFactor(factor: Int) // processed when parsing configuration, artifically place timings case class TickFactor(factor: Int) // processed when parsing configuration, artifically place timings
case class Cell(x: Int, y: Int) case class Cell(x: Int, y: Int) {
def distance(otherCell: Cell): Double = {
Math.sqrt(Math.pow(x - otherCell.x, 2) + Math.pow(y - otherCell.y, 2))
}
}
case class Group(name: String, sensorParent: Option[String] = None){ case class Group(name: String, sensorParent: Option[String] = None){
// the sensorParent serves as indicator for the parser that a ground truth is not required // the sensorParent serves as indicator for the parser that a ground truth is not required
// TODO: use parent as get function and parent.set as setter to make var private // TODO: use parent as get function and parent.set as setter to make var private

View File

@@ -3,6 +3,8 @@ package scim.lib
// java imports // java imports
import java.io.{File, FileInputStream} import java.io.{File, FileInputStream}
import scim.datastruct.FunctionArgs
import scala.collection.immutable.ListMap import scala.collection.immutable.ListMap