/tmp/duangsuse.sock
23 subscribers
303 photos
3 videos
92 files
337 links
从 duangsuse::Echo (@dsuse) 跟进出来的分支,将在作者恢复原帐号访问的时候合并删除。
Download Telegram
Turtle.kt
2.3 KB
#Kotlin #code 画画的程序 当然只是核心部分
import kotlin.math.sin
import kotlin.math.cos
import kotlin.math.PI

protected fun forward(distance: Double) {
val pA = position
val distanceAB = distance.distanceDegree(rotation)
val pB = pA + distanceAB
canvas.drawLine(pA.x, pA.y, pB.x, pB.y)
position.assign(pB)
}
private fun Double.distanceDegree(rotation: Deg): Point2 {
val d = this; val r = rotation.coerceRad()
return Point( (d*cos(r)).toInt(), (d*sin(r)).toInt() )
}

最核心的科技
protected var rotation: Deg get() = rawRotation*FULL_DEG
set(d) { rawRotation = d/FULL_DEG }
protected fun rotate(deg: Double) { rotation += deg }
protected fun forward(distance: Double) {
val pA = position
val distanceAB = distance.lineDegreed(rotation)
val pB = pA + distanceAB
canvas.drawLine(pA.x, pA.y, pB.x, pB.y)
position.assign(pB)
}
private fun Double.lineDegreed(rotation: Deg): Point2 {
val d = this; val r = rotation.coerceRad()
return Point( (d*cos(r)).toInt(), (d*sin(r)).toInt() )
}
/** Coerce to radix from degree */
fun Deg.coerceRad() = this / 180.0 * PI
Turtle.kt
2.6 KB
#Kotlin #code Turtle 最终版本。“我真的不更了”——duangsuse
“我们就是死,也不会再多编辑一次的。”——duangsuse
Forwarded from KU 39
修复了一个关于 rotate 的 bug,看起来现在不错哦
新的 Turtle 基本操作
Turtle.kt
2.9 KB
#Kotlin #code 又更新了一次
Turtle.kt
4.1 KB
最后一次了!下次就是带脚本语言的版本了! #Kotlin #code
/tmp/duangsuse.sock
#GithHub 这么好玩的东西,我没精力维护就直接堆 Share 了,也真是可惜(迫真)
说起来,现在 Share 还没人打星,谁愿意抢个前排???(
本苏可是做好了包装哦,
LICENSE README.md .gitignore
三 大 文 件 缺一不可
#GitHub 本苏的 https://github.com/duangsuse-valid-projects
86 repos,81 sources、3 archived、2 forks,不带半点完全没有本苏手作的代码,系这两年堆积而来。

其中 2019.6 从别处导入的占 62 个,换句话说,这半年来我开了 24 个 repo。

不明觉厉?受到启发?心情不错? 求星 🌟 😘 求 follow (迫真)
看到这么努力的 duangsuse,不觉得有想嘉奖一下的冲动么?!
/tmp/duangsuse.sock pinned «#GitHub 本苏的 https://github.com/duangsuse-valid-projects 86 repos,81 sources、3 archived、2 forks,不带半点完全没有本苏手作的代码,系这两年堆积而来。 其中 2019.6 从别处导入的占 62 个,换句话说,这半年来我开了 24 个 repo。 不明觉厉?受到启发?心情不错? 求星 🌟 😘 求 follow (迫真) 看到这么努力的 duangsuse,不觉得有想嘉奖一下的冲动么?!»
#Haha #coolapk #China #Low 酷安服务器:我们也无话可说,你懂的。
Forwarded from 康娜的笔记本 (康娜卡姆依 | 是一个永远单推湊あくあ的人 | 华为海军预备役 | 长大之后想呆在🇹🇼)
魔 幻 现 实