In seismic frequency-domain finite-difference modeling, the numerical accuracy depends on how mass and partial differential terms are discretized in the acoustic/elastic wave equation. For the mass term(s), a combination of consistent and lumped mass methods is widely accepted. For the partial differential terms, there exist many discretization technologies, such as the average-derivative method (ADM) and the rotated mixed-grid method (RMM). In comparison with the ADM, which focuses on the media interior, the RMM is excellent at handling the media interior and free-surface boundary simultaneously. However, the existing RMMs are based on the orthogonal coordinate transformation and suffer from the restriction of cube-grid sampling. Affine coordinate systems do not restrict the axes to be orthogonal. By introducing the 3D affine coordinate transformations to the RMM, we have developed an affine mixed-grid method and generated an optimal 27-point scheme for the 3D elastic wave equation. Our scheme removes the sampling restriction of cubic mesh, thus working for general cuboid mesh. In addition, it provides consistent expressions in the whole computational domain, thus improving the accuracies of the internal and free-surface grid points simultaneously. Dispersion analysis and numerical examples demonstrate that our scheme provides acceptable accuracy with five points per minimal S-wavelength for the internal and free-surface points with arbitrary spatial grid intervals.