पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv1.2.0

dart_earcut

https://github.com/mapbox/earcut पर आधारित कार्यक्षम त्रिभुजीकरण एल्गोरिदम

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
11.4 लाख
लाइक
10
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add dart_earcut

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

dart_earcut एक उच्च प्रदर्शन त्रिकोणीकरण लाइब्रेरी है जो Dart के लिए है, जिसमें मैपबॉक्स द्वारा मूल रूप से विकसित ईआरकट एल्गोरिथ्म शामिल है। यह बहुभुज आकृतियों को त्रिभुज में बदलने के लिए कुशलता से काम करता है, जिससे यह 2D ग्राफिक्स और विज़ुअलाइज़ेशन एप्लिकेशन में जटिल ज्यामिति के निरूपण के लिए आदर्श है। यह पैकेज Android, iOS, Web, macOS, Windows और Linux जैसे कई प्लेटफॉर्म को समर्थन देता है, जिससे प्लेटफॉर्म के बीच सुसंगतता सुनिश्चित होती है। गति और सटीकता के लिए डिज़ाइन किया गया, यह सरल और जटिल बहुभुजों के साथ छेदों के साथ भी काम करता है, जिससे गणितीय ज्यामिति के कार्यों के लिए विश्वसनीय परिणाम प्रदान करता है।

उपयोग

  • 2D गेम डेवलपमेंट
  • वेब-आधारित मानचित्र रेंडरिंग
  • वेक्टर ग्राफिक्स प्रोसेसिंग
  • इंटरैक्टिव डेटा विज़ुअलाइज़ेशन
  • UI घटकों के लिए नेटवर्क उत्पादन

मुख्य विशेषताएँ

  • त्वरित त्रिभुजीकरण प्रदर्शन
  • छेद वाले बहुभुज का समर्थन करता है
  • क्रॉस-प्लेटफॉर्म संगतता
  • बहुभुज इनपुट के लिए सरल API
  • जटिल आकृतियों के लिए सटीक परिणाम

इनके लिए उपयुक्त

  • ग्राफिक्स विकासकर्ता
  • जीआईएस एप्लिकेशन निर्माता
  • कस्टम आकृतियों के साथ काम कर रहे UI/UX डिजाइनर
  • गेम इंजन इंटीग्रेटर्स
  • डेटा विज़ुअलाइजेशन इंजीनियर्स

विचार योग्य बातें

  • वैध बहुभुज इनपुट की आवश्यकता होती है (गैर-प्रतिच्छेदन किनारे)
  • वास्तविक समय के डायनामिक अपडेट के लिए अनअनुकूलित
  • 2D त्रिकोणीकरण तक सीमित
  • स्वयं-प्रतिच्छेदी बहुभुज का सीधे से निपटने के लिए नहीं है
  • अनियमित इनपुट के लिए पूर्व प्रसंस्करण की आवश्यकता हो सकती है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

dart_earcut

Ear-clipping (earcutting) triangulation algorithm, ported (with minor API differences) from earcut4j/earcut4j and mapbox/earcut. Also includes the fix from mapbox/earcut#91.

Usage

  • 2D (x/y) coordinates, without holes

    • triangulateRaw: expects points in the format [x0, y0, x1, y1, x2, y2, ...]
    • triangulateFromPoints: expects 'dart:math's Point objects
    final triangles = Earcut.triangulateRaw([10,0, 0,50, 60,60, 70,10]);
    final triangles = Earcut.triangulateFromPoints([Point(10, 0), Point(0,50), Point(60,60), Point(70,10)]);
    // Both return [1,0,3, 3,2,1]
    
  • Holes
    A list of hole indicies, if any. For example, [5, 8] for a 12-vertice input would mean one hole with vertices 5-7 and another with 8-11. If you pass a single vertice as a hole, Earcut treats it as a Steiner point.

    final List<int> triangles = Earcut.triangulateRaw([0, 0, 100, 0, 100, 100, 0, 100, 20, 20, 80, 20, 80, 80, 20, 80], holeIndices: [4]);
    // Returns [3,0,4, 5,4,0, 3,4,7, 5,0,1, 2,3,7, 6,5,1, 2,7,6, 6,1,2]
    
    • triangulateFromPointsAndHolePoints performs the logic to generate holeIndices when the outline of a polygon and the outline of its holes are available as points seperately.
  • More dimensions
    Expected to be in the format [x0, y0, z0, x1, y1, z1, x2, y2, z2, ...]

    final List<int> triangles = Earcut.triangulateRaw([10, 0, 1, 0, 50, 2, 60, 60, 3, 70, 10, 4], dimensions: 3);
    // Returns [1,0,3, 3,2,1]
    

The Algorithm

The library implements a modified ear slicing algorithm, optimized by z-order curve hashing and extended to handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't guarantee correctness of triangulation, but attempts to always produce acceptable results for practical data.

It's based on ideas from FIST: Fast Industrial-Strength Triangulation of Polygons by Martin Held andTriangulation by Ear Clipping by David Eberly.

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट