The discrete dipole approximation: from Maxwell’s equations to practical applications