Using extreme principles, we consider a process of propagation of a crack through structural boundaries in an inhomogeneous material. Taking into consideration the presence of zones of transition when grains (structural elements) are in contact, we obtain a local nonlinear equation for the trajectory of the crack. It is concluded that the trajectory depends on the width of the zone of transition, on the Young moduli of contacting materials, and on the stresses in samples.