Is compulsory sterilization of criminals legal?

This is the case of Skinner v. State of Oklahoma, ex rel. Williamson (316 U.S. 535, 1942). The United States (US) Supreme Court ruled that laws permitting the compulsory sterilization of criminals are unconstitutional if the sterilization law treats similar crimes differently. The relevant Oklahoma law applied to "habitual criminals," but the law excluded white-collar crimes from carrying sterilization penalties. The Court held that treating similar crimes differently violated the Equal Protection Clause of the 14th Amendment. (Skinner v. Oklahoma - Wikipedia. en.wikipedia.org/wiki/Skinner_v._Oklahoma)

Under Oklahoma's Habitual Criminal Sterilization Act of 1935, the state could impose a sentence of compulsory sterilization as part of their judgment against individuals who had been convicted three or more times of crimes "amounting to felonies involving moral turpitude." The defendant, Jack T. Skinner, had been convicted once for chicken-stealing and twice for armed robbery. (Skinner v. Oklahoma - Wikipedia. en.wikipedia.org/wiki/Skinner_v._Oklahoma)

The motivation behind the law was primarily eugenic: to try to weed out "unfit" individuals from the gene pool.RULING BY THE US SUPREME COURT:
Oklahoma makes no attempt to say that he who commits larceny by trespass or trick or fraud has biologically inheritable traits which he who commits embezzlement lacks. We have not the slightest basis for inferring that line has any significance in eugenics, nor that the inheritability of criminal traits follows the neat legal distinctions which the law has marked between those two offenses. In terms of fines and imprisonment, the crimes of larceny and embezzlement rate the same under the Oklahoma code. Only when it comes to sterilization are the pains and penalties of the law different. The equal protection clause would indeed be a formula of empty words if such conspicuously artificial lines could be drawn. xxx
The power to sterilize, if exercised, may have subtle, far-reaching and devastating effects. In evil or reckless hands it can cause races or types which are inimical to the dominant group to wither and disappear. There is no redemption for the individual whom the law touches. Any experiment which the State conducts is to his irreparable injury. He is forever deprived of a basic liberty. We mention these matters not to reexamine the scope of the police power of the States. We advert to them merely in emphasis of our view that strict scrutiny of the classification which a State makes in a sterilization law is essential, lest unwittingly, or otherwise, invidious discriminations are made against groups or types of individuals in violation of the constitutional guaranty of just and equal laws.
Does this mean, therefore, that, if a compulsory sterilization law treats similar crimes and criminals similarly, it would be valid? The answer is still no because, under the 1987 Constitution, "Excessive fines shall not be imposed, nor cruel, degrading or inhuman punishment inflicted. Neither shall death penalty be imposed, unless, for compelling reasons involving heinous crimes, the Congress hereafter provides for it. Any death penalty already imposed shall be reduced to reclusion perpetua." (Section 19 of Article III)