0022904: Clean up sccsid variables
[occt.git] / src / Expr / Expr_ArcSine.cxx
CommitLineData
7fd59977 1// Copyright: Matra-Datavision 1991
2// File: Expr_ArcSine.cxx
3// Created: Mon May 27 11:31:25 1991
4// Author: Arnaud BOUZY
5// <adn>
6
7#include <Expr_ArcSine.ixx>
8#include <Expr_NumericValue.hxx>
9#include <Expr_Sine.hxx>
10#include <Expr_Division.hxx>
11#include <Expr_Square.hxx>
12#include <Expr_Difference.hxx>
13#include <Expr_SquareRoot.hxx>
14#include <Expr_Operators.hxx>
15#include <Expr.hxx>
16
17Expr_ArcSine::Expr_ArcSine (const Handle(Expr_GeneralExpression)& exp)
18{
19 CreateOperand(exp);
20}
21
22Handle(Expr_GeneralExpression) Expr_ArcSine::ShallowSimplified () const
23{
24 Handle(Expr_GeneralExpression) op = Operand();
25 if (op->IsKind(STANDARD_TYPE(Expr_NumericValue))) {
26 Handle(Expr_NumericValue) valop = Handle(Expr_NumericValue)::DownCast(op);
27 return new Expr_NumericValue(ASin(valop->GetValue()));
28 }
29 if (op->IsKind(STANDARD_TYPE(Expr_Sine))) {
30 return op->SubExpression(1);
31 }
32 Handle(Expr_ArcSine) me = this;
33 return me;
34}
35
36Handle(Expr_GeneralExpression) Expr_ArcSine::Copy () const
37{
38 return new Expr_ArcSine(Expr::CopyShare(Operand()));
39}
40
41Standard_Boolean Expr_ArcSine::IsIdentical (const Handle(Expr_GeneralExpression)& Other) const
42{
43 if (!Other->IsKind(STANDARD_TYPE(Expr_ArcSine))) {
44 return Standard_False;
45 }
46 Handle(Expr_GeneralExpression) op = Operand();
47 return op->IsIdentical(Other->SubExpression(1));
48}
49
50Standard_Boolean Expr_ArcSine::IsLinear () const
51{
52 if (ContainsUnknowns()) {
53 return Standard_False;
54 }
55 return Standard_True;
56}
57
58Handle(Expr_GeneralExpression) Expr_ArcSine::Derivative (const Handle(Expr_NamedUnknown)& X) const
59{
60 if (!Contains(X)) {
61 return new Expr_NumericValue(0.0);
62 }
63 Handle(Expr_GeneralExpression) op = Operand();
64 Handle(Expr_GeneralExpression) derop = op->Derivative(X);
65
66 Handle(Expr_Square) sq = new Expr_Square(Expr::CopyShare(op));
67 // 1 - X2
68 Handle(Expr_Difference) thedif = 1.0 - sq->ShallowSimplified();
69
70 // sqrt(1-X2)
71 Handle(Expr_SquareRoot) theroot = new Expr_SquareRoot(thedif->ShallowSimplified());
72
73 // ArcSine'(F(X)) = F'(X)/sqrt(1-F(X)2)
74 Handle(Expr_Division) thediv = derop / theroot->ShallowSimplified();
75
76 return thediv->ShallowSimplified();
77}
78
79Standard_Real Expr_ArcSine::Evaluate(const Expr_Array1OfNamedUnknown& vars, const TColStd_Array1OfReal& vals) const
80{
81 return ::ASin(Operand()->Evaluate(vars,vals));
82}
83
84TCollection_AsciiString Expr_ArcSine::String() const
85{
86 TCollection_AsciiString str("ASin(");
87 str += Operand()->String();
88 str += ")";
89 return str;
90}