SCAR Code:
//This function calculates the angle between two vectors in 3D
Procedure DPAngle(X1,Y1,Z1,X2,Y2,Z2 :Extended);
Begin
Writeln('The angle is '+Inttostr(Round((180/(pi))*Arccos((X1*X2+Y1*Y2+Z1*Z2)/((Hypot(X1,Sqrt(Y1*Y1+Z1*Z1)))*(Hypot(X2,Sqrt(Y2*Y2+Z2*Z2)))))))+'.');
End;
//This function calculates the center of mass of an object in 2d
Procedure Centerofmass(A, MX, MY: Extended);
var
X, Y: Extended;
Begin
Cleardebug;
Writeln('A is the Integral of the density function times FTop-FBottom from a to b');
Writeln('MX is the Integral of the density function times FTop^2-FBottom^2 from a to b');
Writeln('MY is the Integral of the density function times X(FTop-FBottom) from a to b');
X:=Round(1000*MY/A)/1000;
Y:=Round(1000*MX/(2*A))/1000;
Writeln('The center of mass is located at ('+floattostr(X)+','+floattostr(Y)+').');
End;