1 /*
  2     Copyright 2008,2009
  3         Matthias Ehmann,
  4         Michael Gerhaeuser,
  5         Carsten Miller,
  6         Bianca Valentin,
  7         Alfred Wassermann,
  8         Peter Wilfahrt
  9 
 10     This file is part of JSXGraph.
 11 
 12     JSXGraph is free software: you can redistribute it and/or modify
 13     it under the terms of the GNU Lesser General Public License as published by
 14     the Free Software Foundation, either version 3 of the License, or
 15     (at your option) any later version.
 16 
 17     JSXGraph is distributed in the hope that it will be useful,
 18     but WITHOUT ANY WARRANTY; without even the implied warranty of
 19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20     GNU Lesser General Public License for more details.
 21 
 22     You should have received a copy of the GNU Lesser General Public License
 23     along with JSXGraph. If not, see <http://www.gnu.org/licenses/>.
 24 */
 25 
 26 /** 
 27  * @fileoverview This file contains the class Algebra, a wrapper for all kind of calculations. It's only here for
 28  * backward compatibility reasons, so please don't use it.
 29  */
 30  
 31 /**
 32  * DEPRECATED! This class may be removed in future JSXGraph releases. Creates a new instance of Algebra.
 33  * @class This class is just for backward compatibility and may be removed in future versions of JSXGraph.
 34  * please DO NOT USE ANY OF THESE METHODS but the given alternative.
 35  * @constructor
 36  */
 37 JXG.Algebra = function (/** JXG.Board */ board) {
 38     /**
 39      * Reference to board.
 40      * @type JXG.Board
 41      */
 42     this.board = board;
 43     
 44     /**
 45      * Use JXG.Math.eps instead.
 46      * Defines float precision. Every number <tt>f</tt> with
 47      * Math.abs(f) < eps is assumed to be zero.
 48      * @default {@link JXG.Math#eps}
 49      * @see JXG.Math#eps
 50      * @deprecated
 51      */
 52     this.eps = JXG.Math.eps;
 53 };
 54 
 55 /**
 56  * @deprecated Use {@link JXG.Math.Geometry#rad} instead.
 57  */
 58 JXG.Algebra.prototype.angle = function(A, B, C) {   
 59     return JXG.Math.Geometry.angle(A, B, C);
 60 };
 61 
 62 /**
 63  * @deprecated Use {@link JXG.Math.Geometry#trueAngle} instead.
 64  */
 65 JXG.Algebra.prototype.trueAngle = function(A, B, C) {
 66     return this.rad(A,B,C)*57.295779513082323;
 67 };
 68 
 69 /**
 70  * @deprecated Use {@link JXG.Math.Geometry#rad} instead.
 71  */
 72 JXG.Algebra.prototype.rad = function(A,B,C) {
 73     return JXG.Math.Geometry.rad(A, B, C);
 74 };
 75 
 76 /**
 77  * @deprecated Use {@link JXG.Math.Geometry#angleBisector} instead.
 78  */
 79 JXG.Algebra.prototype.angleBisector = function(/** JXG.Point */ A, /** JXG.Point */ B, /** JXG.Point */ C) /** JXG.Coords */ {
 80     return JXG.Math.Geometry.angleBisector(A, B, C, this.board);
 81 };
 82 
 83 /**
 84  * @deprecated Use {@link JXG.Math.Geometry#reflection} instead.
 85  */  
 86 JXG.Algebra.prototype.reflection = function(line,point) {
 87     return JXG.Math.Geometry.reflection(line, point, this.board);
 88 };
 89 
 90 /**
 91  * @deprecated Use {@link JXG.Math.Geometry#rotation} instad.
 92  */
 93 JXG.Algebra.prototype.rotation = function(rotpoint, point, phi) {
 94     return JXG.Math.Geometry.rotation(rotpoint, point, phi, this.board);
 95 };
 96 
 97 /**
 98  * @deprecated Use {@link JXG.Math.Geometry#perpendicular} instead.
 99  */
100 JXG.Algebra.prototype.perpendicular = function(line, point) {
101     return JXG.Math.Geometry.perpendicular(line, point, this.board);           
102 };
103 
104 /**
105  * @deprecated Use {@link JXG.Math.Geometry#circumcenterMidpoint} instead.
106  */
107 JXG.Algebra.prototype.circumcenterMidpoint = function(point1, point2, point3) {
108     return JXG.Math.Geometry.circumcenterMidpoint(point1, point2, point3, this.board);
109 };
110 
111 /**
112  * @deprecated Use {@link JXG.Math.Geometry#intersectLineLine} instead.
113  */
114 JXG.Algebra.prototype.intersectLineLine = function(line1, line2) {
115     return JXG.Math.Geometry.intersectLineLine(line1, line2, this.board);
116 };
117 
118 /**
119  * @deprecated Use {@link JXG.Math.Geometry#intersectCircleLine} instead.
120  */
121 JXG.Algebra.prototype.intersectCircleLine = function(circle, line) {
122     return JXG.Math.Geometry.intersectCircleLine(circle, line, this.board);
123 };
124 
125 /**
126  * @deprecated Use {@link JXG.Math.Geometry#intersectCircleCircle} instead.
127  */
128 JXG.Algebra.prototype.intersectCircleCircle = function(circle1, circle2) { 
129     return JXG.Math.Geometry.intersectCircleCircle(circle1, circle2, this.board);
130 };
131 
132 /**
133  * @deprecated Use {@link JXG.Math.Geometry#projectPointToCircle} instead.
134  */
135 JXG.Algebra.prototype.projectPointToCircle = function(point,circle) {
136     return JXG.Math.Geometry.projectPointToCircle(point, circle, this.board);
137 };
138 
139 /**
140  * @deprecated Use {@link JXG.Math.Geometry#projectPointToLine} instead.
141  */
142 JXG.Algebra.prototype.projectPointToLine = function(point, line) {
143     return JXG.Math.Geometry.projectPointToLine(point, line, this.board);
144 };
145 
146 /**
147  * @deprecated Use {@link JXG.Math.Geometry#projectPointToCurve} instead.
148  */
149 JXG.Algebra.prototype.projectPointToCurve = function(point,curve) {
150     return JXG.Math.Geometry.projectPointToCurve(point,curve,this.board);
151 };
152 
153 /**
154  * @deprecated Use {@link JXG.Math.Geometry#projectCoordsToCurve} instead.
155  */
156 JXG.Algebra.prototype.projectCoordsToCurve = function(x,y,t,curve) {
157     return JXG.Math.Geometry.projectCoordsToCurve(x,y,t,curve,this.board);
158 };
159 
160 /**
161  * @deprecated Use {@link JXG.Math.Geometry#projectPointToTurtle} instead.
162  */
163 JXG.Algebra.prototype.projectPointToTurtle = function(point,turtle) {
164     return JXG.Math.Geometry.projectPointToTurtle(point,turtle,this.board);
165 };
166 
167 /**
168  * @deprecated Use {@link JXG.GeonextParser#replacePow} instead.
169  */
170 JXG.Algebra.prototype.replacePow = function(te) {
171     return JXG.GeonextParser.replacePow(te);
172 };
173 
174 /**
175  * @deprecated Use {@link JXG.GeonextParser#replaceIf} instead;
176  */
177 JXG.Algebra.prototype.replaceIf = function(te) {
178     return JXG.GeonextParser.replaceIf(te);
179 };
180 
181 /**
182  * @deprecated Use {@link JXG.GeonextParser#replaceSub} instead.
183  */
184 JXG.Algebra.prototype.replaceSub = function(te) {
185     return JXG.GeonextParser.replaceSub(te);
186 };
187 
188 /**
189  * @deprecated Use {@link JXG.GeonextParser#replaceSup} instead.
190  */
191 JXG.Algebra.prototype.replaceSup = function(te) {
192     return JXG.GeonextParser.replaceSup(te);
193 };
194 
195 /**
196  * @deprecated Use {@link JXG.GeonextParser#replaceNameById} instead.
197  **/
198 JXG.Algebra.prototype.replaceNameById = function(/** string */ term) /** string */ {
199     return JXG.GeonextParser.replaceNameById(term, this.board);
200 };
201 
202 /**
203  * @deprecated Use {@link JXG.GeonextParser#replaceIdByObj} instead.
204  **/
205 JXG.Algebra.prototype.replaceIdByObj = function(/** string */ term) /** string */ {
206     return JXG.GeonextParser.replaceIdByObj(term);
207 };
208 
209 /**
210  * @deprecated Use {@link JXG.GeonextParser#geonext2JS} instead.
211  */
212 JXG.Algebra.prototype.geonext2JS = function(term) {
213     return JXG.GeonextParser.geonext2JS(term, this.board);
214 };
215 
216 /**
217  * @deprecated Use {@link JXG.GeonextParser#findDependencies} instead.
218  */
219 JXG.Algebra.prototype.findDependencies = function(me, term) {
220     JXG.GeonextParser.findDependencies(me, term, this.board);
221 };
222 
223 /**
224  * @deprecated Use {@link JXG.Math.Geometry#distance} instead.
225  */
226 JXG.Algebra.prototype.distance = function(array1, array2) {
227     return JXG.Math.Geometry.distance(array1, array2);
228 };
229 
230 /**
231  * @deprecated Use {@link JXG.Math.Geometry#affineDistance} instead.
232  */
233 JXG.Algebra.prototype.affineDistance = function(array1, array2) {
234     return JXG.Math.Geometry.affineDistance(array1, array2);
235 };
236 
237 /**
238  * @deprecated Use {@link JXG.Math#pow} instead.
239  */
240 JXG.Algebra.prototype.pow = function(/** number */ a, /** number */ b) /** number */ {
241     return JXG.Math.pow(a, b);
242 };
243 
244 /**
245  * @private
246  * @deprecated Use {@link JXG.Math.Geometry#meet} instead.
247  */
248 JXG.Algebra.prototype.meet = function(el1, el2, /** number */ i) /** JXG.Coords */ {
249     return JXG.Math.Geometry.meet(el1, el2, i, this.board);
250 };
251 
252 /**
253   * @private
254   * @deprecated Use {@link JXG.Math.Geometry#meetLineLine} instead.
255   */
256 JXG.Algebra.prototype.meetLineLine = function(l1,l2,i) {
257     return JXG.Math.Geometry.meetLineLine(l1,l2,i,this.board);
258 };
259 
260 /**
261   * @private
262   * 
263   * @deprecated Use {@link  JXG.Math.Geometry#meetLineCircle} instead.
264   */
265  JXG.Algebra.prototype.meetLineCircle = function(lin,circ,i) {    
266         return  JXG.Math.Geometry.meetLineCircle(lin,circ,i,this.board);
267 };
268 
269 /**
270   * @private
271   * @deprecated Use {@link JXG.Math.Geometry#meetCircleCircle} instead.
272   */
273 JXG.Algebra.prototype.meetCircleCircle = function(circ1,circ2,i) {
274     return JXG.Math.Geometry.meetCircleCircle(circ1,circ2,i,this.board);
275 };
276 
277 /**
278   * @private
279   * @deprecated Use {@link JXG.Math#normalize} instead.
280   */
281 JXG.Algebra.prototype.normalize = function(stdform) {
282     return JXG.Math.normalize(stdform);
283 };
284 
285 /**
286  * @private
287  * @deprecated Use {@link JXG.Math.Geometry#meetCurveCurve} instead.
288  */
289 JXG.Algebra.prototype.meetCurveCurve = function(c1,c2,t1ini,t2ini) {
290     return JXG.Math.Geometry.meetCurveCurve(c1,c2,t1ini,t2ini,this.board);
291 };
292 
293 /**
294  * @private
295  * @deprecated Use {@link JXG.Math.Geometry#meetCurveLine} instead.
296  */
297 JXG.Algebra.prototype.meetCurveLine = function(el1,el2,nr) {
298     return JXG.Math.Geometry.meetCurveLine(el1,el2,nr,this.board);
299 };
300