संदर्भ applyMatrix()

applyMatrix()

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

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

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

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

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

applyMatrix को 2D में कॉल करते समय उपयोग किया जाने वाला ट्रांसफ़ॉर्मेशन मैट्रिक्स मोड।

संख्याओं को अलग-अलग पारित किया जा सकता है, जैसे कि मैट्रिक्स लागू करें(2, 0, 0, 0, 2, 0)। उन्हें एक सरणी में भी पारित किया जा सकता है, जैसे applyMatrix([2, 0, 0, 0, 2, 0])

3डी मोड में, पैरामीटर , बी, सी, डी, ई< /code>, एफ, जी, एच, आई, जे, के, एल, एम, n, o, और p निम्नलिखित परिवर्तन मैट्रिक्स में तत्वों के अनुरूप हैं:

='जब

संख्याओं को अलग-अलग पास किया जा सकता है, जैसे applyMatrix(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)< /code>. वे किसी ऐरे में भी पारित किया जा सकता है, जैसे कि applyMatrix([2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1])< /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>

उदाहरण

सिंटैक्स

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.

This page is generated from the comments in src/core/transform.js . Please feel free to edit it and submit a pull request!

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