संदर्भ applyMatrix()

applyMatrix()

निर्देशांक प्रणाली में एक परिवर्तन मैट्रिक्स लागू करता है।

रूपांतरण जैसे translate(), rotate(), और scale() पर्दे के पीछे मैट्रिक्स-वेक्टर गुणन का उपयोग करें। संख्याओं की एक तालिका, जिसे मैट्रिक्स कहा जाता है, प्रत्येक परिवर्तन को एन्कोड करती है। फिर मैट्रिक्स में मान कैनवास पर प्रत्येक बिंदु को गुणा करते हैं, जिसे एक वेक्टर द्वारा दर्शाया जाता है।

applyMatrix() एक साथ कई परिवर्तनों को लागू करने की अनुमति देता है। देखें विकिपीडिया और MDN परिवर्तनों के बारे में अधिक जानकारी के लिए।

दो और तीन आयामों में applyMatrix() को कॉल करने के दो तरीके हैं।

2डी मोड में, पैरामीटर , बी, सी, डी, ई&lt; /code&gt;, और <code>एफ</code>, निम्नलिखित परिवर्तन मैट्रिक्स में तत्वों के अनुरूप हैं:

<blockquote> <p><img style="max-width: 150px" src="/assets/transformation-matrix.png" alt="applyMatrix को 2D में कॉल करते समय उपयोग किया जाने वाला ट्रांसफ़ॉर्मेशन मैट्रिक्स मोड।"></p> </blockquote> <p>संख्याओं को अलग-अलग पारित किया जा सकता है, जैसे कि <code>मैट्रिक्स लागू करें(2, 0, 0, 0, 2, 0)</code>। उन्हें एक सरणी में भी पारित किया जा सकता है, जैसे <code>applyMatrix([2, 0, 0, 0, 2, 0])</code></p> <p>3डी मोड में, पैरामीटर <code>ए</code>, <code>बी</code>, <code>सी</code>, <code>डी</code>, <code>ई&lt; /code&gt;, <code>एफ</code>, <code>जी</code>, <code>एच</code>, <code>आई</code>, <code>जे</code>, <code>के</code>, <code>एल</code>, <code>एम</code>, <code>n</code>, <code>o</code>, और <code>p</code> निम्नलिखित परिवर्तन मैट्रिक्स में तत्वों के अनुरूप हैं:</code></p><code> <p><img style="max-width: 300px" src="/assets/transformation-matrix-4-4.png" alt="='जब" applymatrix="" को="" 3d="" मोड="" में="" कॉल="" किया="" जाता="" है="" तो="" परिवर्तन="" मैट्रिक्स="" का="" उपयोग="" है।'=""></p> <p>संख्याओं को अलग-अलग पास किया जा सकता है, जैसे <code>applyMatrix(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)&lt; /code&gt;. वे किसी ऐरे में भी पारित किया जा सकता है, जैसे कि <code>applyMatrix([2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1])&lt; /code&gt;.</code></code></p><code><code> <p>डिफ़ॉल्ट रूप से, परिवर्तन एकत्रित होते हैं। <a href="/reference/p5/push">push()</a> और <a href="/reference/p5/pop">pop()</a> फ़ंक्शंस का उपयोग भीतर परिवर्तनों को अलग करने के लिए किया जा सकता है विशिष्ट ड्राइंग समूह।</p> <p> ध्यान दें: ट्रांसफ़ॉर्मेशन ड्रॉ लूप की शुरुआत में रीसेट किए जाते हैं। <a ref="/reference/p5/draw">draw()</a> फ़ंक्शन के अंदर <code>applyMatrix()</code> को कॉल करने से आकृतियों में लगातार परिवर्तन नहीं होगा।</p> </code></code></code>

उदाहरण

सिंटैक्स

applyMatrix(arr)
applyMatrix(a, b, c, d, e, f)
applyMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)

पैरामीटर्स

arr
Array:

an array containing the elements of the transformation matrix. Its length should be either 6 (2D) or 16 (3D).

a
Number:

an element of the transformation matrix.

b
Number:

an element of the transformation matrix.

c
Number:

an element of the transformation matrix.

d
Number:

an element of the transformation matrix.

e
Number:

an element of the transformation matrix.

f
Number:

an element of the transformation matrix.

g
Number:

an element of the transformation matrix.

h
Number:

an element of the transformation matrix.

i
Number:

an element of the transformation matrix.

j
Number:

an element of the transformation matrix.

k
Number:

an element of the transformation matrix.

l
Number:

an element of the transformation matrix.

m
Number:

an element of the transformation matrix.

n
Number:

an element of the transformation matrix.

o
Number:

an element of the transformation matrix.

p
Number:

an element of the transformation matrix.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/transform.js and open a pull request!

संबंधित संदर्भ