Geometry API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Geometry API ช่วยให้คุณสร้างเครื่องมือแบบอินเทอร์แอกทีฟ เช่น กลไกการเลือกและยางลบ
ส่วนนี้จะแสดงวิธีใช้ Geometry API เพื่อใช้ยางลบ
private fun eraseIntersectingStrokes(
currentX: Float,
currentY: Float,
currentStrokes: MutableList<Stroke>,
): Unit {
val prev = previousPoint
previousPoint = MutableVec(currentX, currentY)
if (prev == null) return
val segment = MutableSegment(prev, MutableVec(currentX, currentY))
val parallelogram = MutableParallelogram().populateFromSegmentAndPadding(
segment,
eraserPadding
)
currentStrokes.removeAll {
it.shape.intersects(parallelogram, AffineTransform.IDENTITY)
}
}
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-12-17 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-12-17 UTC"],[],[]]