1 //File gp_Parab2d.cxx JCV 10/01/91
3 #define No_Standard_OutOfRange
5 #include <gp_Parab2d.ixx>
7 gp_Parab2d::gp_Parab2d (const gp_Ax22d& D,
10 gp_XY DCoord = D.XDirection().XY();
11 gp_XY GCoord = D.YDirection().XY();
12 gp_XY PCoord = D.Location().XY();
13 gp_XY MCoord = F.XY();
14 focalLength = DCoord.Dot ( MCoord.Subtracted (PCoord));
15 if (focalLength < 0) focalLength = - focalLength;
17 N.Multiply (focalLength);
20 pos = gp_Ax22d (gp_Pnt2d (MCoord), gp_Dir2d (N));
21 focalLength = focalLength / 2.0;
24 gp_Parab2d::gp_Parab2d (const gp_Ax2d& D,
26 const Standard_Boolean Sense)
28 gp_XY DCoord = D.Direction().XY();
29 gp_XY PCoord = D.Location().XY();
30 gp_XY MCoord = F.XY();
31 focalLength = DCoord.Dot ( MCoord.Subtracted (PCoord));
32 if (focalLength < 0) focalLength = - focalLength;
34 if (Sense) N.SetCoord(DCoord.Y(), -DCoord.X());
35 else N.SetCoord(-DCoord.Y(), DCoord.X());
36 N.Multiply (focalLength);
39 pos = gp_Ax22d (gp_Pnt2d (MCoord), gp_Dir2d (N),Sense);
40 focalLength = focalLength / 2.0;
43 void gp_Parab2d::Coefficients
44 (Standard_Real& A, Standard_Real& B, Standard_Real& C,
45 Standard_Real& D, Standard_Real& E, Standard_Real& F) const
47 Standard_Real P = 2.0 * focalLength;
49 T.SetTransformation (pos.XAxis());
50 Standard_Real T11 = T.Value (1, 1);
51 Standard_Real T12 = T.Value (1, 2);
52 Standard_Real T13 = T.Value (1, 3);
53 Standard_Real T21 = T.Value (2, 1);
54 Standard_Real T22 = T.Value (2, 2);
55 Standard_Real T23 = T.Value (2, 3);
59 D = (T21 * T23) - (P * T11);
60 E = (T22 * T23) - (P * T12);
61 F = (T23 * T23) - (2.0 * P * T13);
64 void gp_Parab2d::Mirror (const gp_Pnt2d& P)
67 gp_Parab2d gp_Parab2d::Mirrored (const gp_Pnt2d& P) const
69 gp_Parab2d Prb = *this;
74 void gp_Parab2d::Mirror (const gp_Ax2d& A)
77 gp_Parab2d gp_Parab2d::Mirrored (const gp_Ax2d& A) const
79 gp_Parab2d Prb = *this;