diff --git a/core/shared/src/main/scala/eu/joaocosta/minart/geometry/ConvexPolygon.scala b/core/shared/src/main/scala/eu/joaocosta/minart/geometry/ConvexPolygon.scala index 34b20c62..513423fc 100644 --- a/core/shared/src/main/scala/eu/joaocosta/minart/geometry/ConvexPolygon.scala +++ b/core/shared/src/main/scala/eu/joaocosta/minart/geometry/ConvexPolygon.scala @@ -45,14 +45,14 @@ final case class ConvexPolygon(vertices: Vector[Shape.Point]) extends Shape { .sum def faceAt(x: Int, y: Int): Option[Shape.Face] = { - val sides = rawWeights(x, y).map(_ >= 0).distinct.toVector + val sides = rawWeights(x, y).filter(_ != 0).map(_ >= 0).distinct.toVector if (sides.size == 1) { if (sides.head) Shape.someFront else Shape.someBack } else None } override def contains(x: Int, y: Int): Boolean = { - rawWeights(x, y).map(_ >= 0).distinct.size == 1 + rawWeights(x, y).filter(_ != 0).map(_ >= 0).distinct.size == 1 } /** Checks if this polygon contains another polygon. diff --git a/core/shared/src/main/scala/eu/joaocosta/minart/graphics/MutableSurface.scala b/core/shared/src/main/scala/eu/joaocosta/minart/graphics/MutableSurface.scala index 1bcb4dd6..a2b57c92 100644 --- a/core/shared/src/main/scala/eu/joaocosta/minart/graphics/MutableSurface.scala +++ b/core/shared/src/main/scala/eu/joaocosta/minart/graphics/MutableSurface.scala @@ -115,8 +115,8 @@ trait MutableSurface extends Surface { * @param frontfaceColor color of the front face * @param backfaceColor color of the back face * @param blendMode blend strategy to use - * @param x position of the shap origin on the destination surface - * @param y position of the shap origin on the destination surface + * @param x position of the shape origin on the destination surface + * @param y position of the shape origin on the destination surface */ def rasterize( shape: Shape, @@ -124,7 +124,7 @@ trait MutableSurface extends Surface { backfaceColor: Option[Color] = None, blendMode: BlendMode = BlendMode.Copy )(x: Int, y: Int): Unit = { - Rasterizer.rasterizeShape(this, shape.translate(-x, -y), frontfaceColor, backfaceColor, blendMode) + Rasterizer.rasterizeShape(this, shape.translate(x, y), frontfaceColor, backfaceColor, blendMode) } /** Modifies this surface using surface view transformations