This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import java.util.function.Predicate | |
import org.testcontainers.containers.GenericContainer.AbstractWaitStrategy | |
import org.testcontainers.containers.output.OutputFrame.OutputType.STDOUT | |
import org.testcontainers.containers.output.{OutputFrame, WaitingConsumer} | |
class WaitForLogLine(val msg: String) extends AbstractWaitStrategy { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# | |
# Copyright (C) 2015 Thomas Amland | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Version = 11 | |
Booleans = {'caretLineVisible': True, 'preferFixed': 1, 'useSelFore': True} | |
CommonStyles = {'attribute name': {'fore': 7872391}, | |
'attribute value': {'fore': 3100463}, | |
'bracebad': {'fore': 3093212}, | |
'bracehighlight': {'fore': 8533715}, | |
'classes': {'fore': 13798182}, | |
'comments': {'fore': 7695960, 'italic': True}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Point(x: Double, y: Double) | |
def orientedBoundingBox(hull: Seq[Point]) = { | |
val (area, rect) = (1 until hull.size).map { i => | |
val (u, v) = (hull(i-1), hull(i)) | |
val angle = math.atan((u.x - v.x) / (u.y - v.y)) | |
val rotated = hull.map(rotate(_, angle)) | |
val xs = rotated.map(_.x) | |
val ys = rotated.map(_.y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A straightforward implementation of the multi-facility Weiszfeld method described by | |
* Iyigun et al. for 2D euclidean. http://dx.doi.org/10.1016/j.orl.2009.11.005 | |
* Have some failings, e.g. if all the initial locations are the same | |
* | |
* @param points The demand points | |
* @param initial Initial locations of facilities | |
*/ | |
def multiWeiszfeld(points: Seq[Point], initial: Seq[Point]): Seq[Point] = { | |
val eps = 1e-6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable.ListBuffer | |
case class Point(x: Double, y: Double) | |
/** Compute the convex hull of given points. Returns vertices ordered ccw */ | |
def convexHull(_points: Seq[Point]): Seq[Point] = { | |
val points = _points.sortBy(_.x) | |
val upper = halfHull(points) | |
val lower = halfHull(points.reverse) | |
upper.remove(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newer version here: https://github.com/tamland/pyhls |