Sets *this to t and returns t. Returning *this would, of course, have exactly the same effect.
Multiplication with assignment by a scalar. This operator multiplies each element E of
matrix
by the scalar r. The return value isr
. This makes it possible to chain invocations of this function: For a_x, b_x, c_x, ..., p_x in R , x in NTransform T0(a_0, b_0, c_0, d_0, e_0, f_0, g_0, h_0, i_0, j_0, k_0 l_0, m_0, n_0, o_0, p_0); Transform T1(a_1, b_1, c_1, d_1, e_1, f_1, g_1, h_1, i_1, j_1, k_1 l_1, m_1, n_1, o_1, p_1); Transform T2(a_2, b_2, c_2, d_2, e_2, f_2, g_2, h_2, i_2, j_2, k_2 l_2, m_2, n_2, o_2, p_2); real r = 5;Let M_0, M_1, and M_2 stand for
T0.matrix
,T1.matrix
, andT2.matrix
respectively:M_0 = a_0 b_0 c_0 d_0 e_0 f_0 g_0 h_0 i_0 j_0 k_0 l_0 m_0 m_0 o_0 p_0 M_1 = a_1 b_1 c_1 d_1 e_1 f_1 g_1 h_1 i_1 j_1 k_1 l_1 m_1 m_1 o_1 p_1 M_2 = a_2 b_2 c_2 d_2 e_2 f_2 g_2 h_2 i_2 j_2 k_2 l_2 m_2 m_2 o_2 p_2T0 *= T1 *= T2 *= r;Now,
M_0 = 5a_0 5b_0 5c_0 5d_0 5e_0 5f_0 5g_0 5h_0 5i_0 5j_0 5k_0 5l_0 5m_0 5m_0 5o_0 5p_0 M_1 = 5a_1 5b_1 5c_1 5d_1 5e_1 5f_1 5g_1 5h_1 5i_1 5j_1 5k_1 5l_1 5m_1 5m_1 5o_1 5p_1 M_2 = 5a_2 5b_2 5c_2 5d_2 5e_2 5f_2 5g_2 5h_2 5i_2 5j_2 5k_2 5l_2 5m_2 5m_2 5o_2 5p_2This function is not currently used anywhere, but it may turn out to be useful for something.
const
operator: Transform operator* (const real r)Multiplication of a
Transform
by a scalar without assignment. The return value is aTransform
A. Ifthis.matrix
has elements E_T, thenA.matrix
has elements E_A such that E_A = r * E_Tfor all E.
Performs matrix multiplication on
matrix
andt.matrix
. The result is assigned tomatrix
. t is returned, not*this
! This makes it possible to chain invocations of this function:Transform a; a.shift(1, 1, 1); Transform b; b.rotate(0, 90); Transform c; c.shear(5, 4); Transform d; d.scale(3, 4, 5);Let a_m, b_m, and c_m stand for
a.matrix
,b.matrix
,c.matrix
, andd.matrix
respectively:a_m = 1 0 0 0 0 1 0 0 0 0 1 0 1 1 1 1 b_m = 0.5 0.5 0.707 0 0.146 0.854 -0.5 0 -0.854 0.146 0.5 0 0 0 0 1 c_m = 1 12 14 0 10 1 15 0 11 13 1 0 0 0 0 1 d_m = 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 1
a *= b *= c *= d;
a
,b
, andc
are transformed byd
, which remains unchanged.Now,
a_m = 3 0 0 0 0 4 0 0 0 0 5 0 3 4 5 1 b_m = 1.5 2 3.54 0 -0.439 3.41 -2.5 0 -2.56 0.586 2.5 0 0 0 0 1 c_m = 3 48 70 0 30 4 75 0 33 52 5 0 0 0 0 1d_m is unchanged.