Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Geometry API
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
The Geometry APIs let you create interactive tools such as selection
mechanisms and erasers.
This section shows how to use the Geometry APIs to implement an eraser.
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 )
}
}
Note: You can implement an eraser that only removes the parts of strokes it
touches by checking if a stroke intersects with individual line segments of a
StrokeInputBatch .
Then, create new StrokeInputBatch and Stroke objects from the line
segments that weren't intersected.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-12-22 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-12-22 (UTC) को अपडेट किया गया."],[],[]]