Upgrade to Pro — share decks privately, control downloads, hide ads and more …

requirements with math

Moony-H
March 15, 2025

requirements with math

Google Developer Group Korea Super.init(V6) Presentation

Moony-H

March 15, 2025
Tweet

Other Decks in Programming

Transcript

  1. ਗ Ӓܻӝ val dx = (circleCenterPos.x - dragPosX).toDouble() val dy

    = (circleCenterPos.y - dragPosY).toDouble() val radPx = sqrt(dx.pow(2.0) + dy.pow(2.0)) val radMeter = radPx * naverMap.projection.metersPerPixel
  2. ਗ Ӓܻӝ MotionEvent.ACTION_MOVE -> { val dragPosX = it.x val

    dragPosY = it.y val dx = (circleCenterPos.x - dragPosX).toDouble() val dy = (circleCenterPos.y - dragPosY).toDouble() val radPx = sqrt(dx.pow(2.0) + dy.pow(2.0)) val radMeter = radPx * naverMap.projection.metersPerPixel circle.radius = if (radMeter > 500) 500.0 else radMeter }
  3. ਗ Ӓܻӝ val x = radiusLimitPx * cos(degree) * -1

    val y = radiusLimitPx * sin(degree) * -1
  4. ਗ Ӓܻӝ MotionEvent.ACTION_MOVE -> { val dragPosX = it.x val

    dragPosY = it.y val dx = (circleCenterPos.x - dragPosX).toDouble() val dy = (circleCenterPos.y - dragPosY).toDouble() val radPx = sqrt(dx.pow(2.0) + dy.pow(2.0)) val radMeter = radPx * naverMap.projection.metersPerPixel }
  5. ਗ Ӓܻӝ if (radPx > radiusLimitPx) { //пب ҳೞӝ val

    degree = atan2(dy, dx) val x = radiusLimitPx * cos(degree) * -1 val y = radiusLimitPx * sin(degree) * -1
  6. ਗ Ӓܻӝ val circleCenterPx = naverMap.projection.toScreenLocation(circle.center) val latLng = naverMap.projection.fromScreenLocation(

    PointF( x.toFloat() + circleCenterPx.x, y.toFloat() + circleCenterPx.y ) ) indicator.position = latLng circle.radius = radiusLimit
  7. ੉޷૑ ഥ੹ val a = touchPos.distanceTo(prevPos) val b = prevPos.distanceTo(imagePos)

    val c = imagePos.distanceTo(touchPos) val cosA = (b.pow(2) + c.pow(2) - a.pow(2)) / (2 * b * c)
  8. ߭ఠ੄ ৻੸ fun Offset.toVectorOffset(offset: Offset) = Offset(offset.x - this.x, offset.y

    - this.y) fun Offset.crossProduct(offset: Offset) = this.x * offset.y - this.y * offset.x