您的位置:首页 > 文旅 > 旅游 > 装修设计公司介绍_2023电商平台排行_网站及推广_西安seo主管

装修设计公司介绍_2023电商平台排行_网站及推广_西安seo主管

2025/1/8 11:49:56 来源:https://blog.csdn.net/u013718730/article/details/144964638  浏览:    关键词:装修设计公司介绍_2023电商平台排行_网站及推广_西安seo主管
装修设计公司介绍_2023电商平台排行_网站及推广_西安seo主管
Dependency
api("io.github.hellogoogle2000:kotlin-commons:+")
Sources
import x.kotlin.commons.serialize.JSON.toJson
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sindata class Point(var x: Double = 0.0, var y: Double = 0.0)fun main() {// basic infoval cx = 100.0val cy = 100.0val R = 100.0val radiusRatio = sin(Math.toRadians(18.0)) / sin(Math.toRadians(126.0))val r = R * radiusRatioval degree = 2 * PI / 5// compute pointsval p1 = Point()val p2 = Point()val p3 = Point()val p4 = Point()val p5 = Point()val p6 = Point()val p7 = Point()val p8 = Point()val p9 = Point()val p10 = Point()p1.x = cxp1.y = cy - Rp2.x = cx + r * sin(degree * 0.5)p2.y = cy - r * cos(degree * 0.5)p3.x = cx + R * sin(degree)p3.y = cy - R * cos(degree)p4.x = cx + r * cos(degree * 1.5 - PI / 2)p4.y = cy + r * sin(degree * 1.5 - PI / 2)p5.x = cx + R * cos(degree * 2 - PI / 2)p5.y = cy + R * sin(degree * 2 - PI / 2)p6.x = cxp6.y = cy + rp7.x = cx - R * cos(degree * 2 - PI / 2)p7.y = cy + R * sin(degree * 2 - PI / 2)p8.x = cx - r * cos(degree * 1.5 - PI / 2)p8.y = cy + r * sin(degree * 1.5 - PI / 2)p9.x = cx - R * sin(degree)p9.y = cy - R * cos(degree)p10.x = cx - r * sin(degree * 0.5)p10.y = cy - r * cos(degree * 0.5)// print pointsval points = listOf(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)println(points.toJson())// print sizeval width = (p3.x - p9.x).toFloat()val height = (p7.y - p1.y).toFloat()val ratio = height / widthprintln("cx=$cx cy=$cy r=$r width=$width height=$height ratio=$ratio")// print sidesval sides = mutableListOf<List<FloatArray>>()for (i in 0 until points.size) {val first = points[i]val second = points[if (i == points.size - 1) 0 else i + 1]val pointPair = listOf(floatArrayOf(first.x.toFloat(), first.y.toFloat()),floatArrayOf(second.x.toFloat(), second.y.toFloat()))sides.add(pointPair)}print(sides.toJson())
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com