Techniques for determining a patient's orientation using an accelerometer that is part of a medical device carried by or implanted in a patient. The medical device may use the accelerometer to determine the orientation of the medical device with respect to gravity. When the medical device is fixed in a known orientation on the patient, the medical device may perform a calculation to determine the orientation of a patient. To simplify calculations and reduce power consumption, the device may calculate an inner product (dot product) multiplication between the orientation vector of the medical device and one or more known reference templates. In some examples, the medical device may determine which reference template is closest to the orientation vector, based on the dot product. In other examples, the medical device may determine one or more body part angles for the patient, based on the dot product.