Skip to content

Commit

Permalink
Simplify line layer for now
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Dec 9, 2023
1 parent 1ccfffd commit c5c1bd5
Showing 1 changed file with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,39 @@ class ARLineLayer(
for (line in lines) {
path.reset()
drawer.stroke(color)
val pixels = getLinePixels(
view,
line,
resolutionDegrees.toFloat(),
maxDistance.toFloat()
)
// TODO: This should clip the lines to the view, just like
for (pixelLine in pixels) {
var previous: PixelCoordinate? = null
for (pixel in pixelLine) {
if (previous != null) {
path.lineTo(pixel.x, pixel.y)
} else {
path.moveTo(pixel.x, pixel.y)
}
previous = pixel

// TODO: This should split the lines into smaller chunks (which will allow distance splitting) - keeping it this way for now for the clinometer
var previous: PixelCoordinate? = null
for (point in line){
val pixel = view.toPixel(point.getHorizonCoordinate(view))
// TODO: This should split the line if the distance is too great
if (previous != null) {
path.lineTo(pixel.x, pixel.y)
} else {
path.moveTo(pixel.x, pixel.y)
}
previous = pixel
}

// Curved + increased resolution
// val pixels = getLinePixels(
// view,
// line,
// resolutionDegrees.toFloat(),
// maxDistance.toFloat()
// )
// for (pixelLine in pixels) {
// var previous: PixelCoordinate? = null
// for (pixel in pixelLine) {
// if (previous != null) {
// path.lineTo(pixel.x, pixel.y)
// } else {
// path.moveTo(pixel.x, pixel.y)
// }
// previous = pixel
// }
// }

drawer.path(path)
}

Expand Down

0 comments on commit c5c1bd5

Please sign in to comment.