No, there is no hard and fast or quantitative rule; there is no % of similarity allowed or disallowed. The determination of whether something infringes or not is a subjective determination, made by patent examiners or judges, depending on the exact procedural context, and is different for different technical or scientific fields, since the stardard "art" (base or broadly known knowledge, processes, or learning) varies so much between them. This question cannot be answered in the abstract with a one-size-fits-all answer. You need to consult in detail about *your* specific planned product and the patent(s) in question with a patent law attorney, to understand what you can and cannot do. If your planned product doesn't justify the cost of the legal consultation, it is not worth going down this road in the first place.