public MyCircumForPath(MyPlane CircumPlane, MySphere circumMySphere) { this.circumplane = CircumPlane; this.circumsphere = circumMySphere; //computation of the circle center: double[] centerSphereVector = { this.circumsphere.centerSphere[0], this.circumsphere.centerSphere[1], this.circumsphere.centerSphere[2] }; var centerSphereOfCircumMyVertex = new MyVertex(centerSphereVector[0], centerSphereVector[1], centerSphereVector[2]); double[] planeNormal = { this.circumplane.a, this.circumplane.b, this.circumplane.c }; var pointOnAxisMyVertex = new MyVertex(centerSphereOfCircumMyVertex.x + planeNormal[0], centerSphereOfCircumMyVertex.y + planeNormal[1], centerSphereOfCircumMyVertex.z + planeNormal[2]); var rotationAxis = FunctionsLC.LinePassingThrough(centerSphereOfCircumMyVertex, pointOnAxisMyVertex); this.circumcenter = FunctionsLC.PointIntersectionOfPlaneAndLine(this.circumplane, rotationAxis); }
//Applicato ad un vertice, dice se il vertice sta sulla sfera data in input public bool Lieonsphere(MySphere givenMySphere) { double toleranceLieOnSphere = Math.Pow(10, -3); return(Math.Abs(Math.Pow(this.x, 2) + Math.Pow(this.y, 2) + Math.Pow(this.z, 2) + givenMySphere.a * this.x + givenMySphere.b * this.y + givenMySphere.c * this.z + givenMySphere.d) < toleranceLieOnSphere); }
protected bool Equals(MySphere other) { return(Equals(centerSphere, other.centerSphere) && radiusSphere.Equals(other.radiusSphere)); }