1 /*
2 * Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
3 * Applied Mathematics, Norway.
4 *
5 * Contact information: E-mail: tor.dokken@sintef.no
6 * SINTEF ICT, Department of Applied Mathematics,
7 * P.O. Box 124 Blindern,
8 * 0314 Oslo, Norway.
9 *
10 * This file is part of SISL.
11 *
12 * SISL is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Affero General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * SISL 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 Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public
23 * License along with SISL. If not, see
24 * <http://www.gnu.org/licenses/>.
25 *
26 * In accordance with Section 7(b) of the GNU Affero General Public
27 * License, a covered work must retain the producer line in every data
28 * file that is created or manipulated using SISL.
29 *
30 * Other Usage
31 * You can be released from the requirements of the license by purchasing
32 * a commercial license. Buying such a license is mandatory as soon as you
33 * develop commercial activities involving the SISL library without
34 * disclosing the source code of your own applications.
35 *
36 * This file may be used in accordance with the terms contained in a
37 * written agreement between you and SINTEF ICT.
38 */
39
40 #include "sisl-copyright.h"
41
42 /*
43 *
44 * $Id: s1399.c,v 1.2 2001-03-19 15:58:49 afr Exp $
45 *
46 */
47
48
49 #define S1399
50
51 #include "sislP.h"
52
53 #if defined(SISLNEEDPROTOTYPES)
54 void
s1399(SISLCurve * pc,double astart,double astop)55 s1399(SISLCurve *pc,double astart,double astop)
56 #else
57 void s1399(pc,astart,astop)
58 SISLCurve *pc;
59 double astart;
60 double astop;
61 #endif
62 /*
63 *********************************************************************
64 *
65 *********************************************************************
66 *
67 * PURPOSE : Change the knotvector to go from astart to astop.
68 *
69 * INPUT : pc - The curve.
70 * astart - Parametervalue at new startpoint.
71 * astop - Parametervalue at new endpoint.
72 *
73 *-
74 * CALLS :
75 *
76 * WRITTEN BY : Morten Daehlen, SI, 88-09.
77 *
78 ********************************************************************/
79 {
80 int kk= pc->ik; /* Order of the input curve. */
81 int kn= pc->in; /* Number of vertices in the input curve.*/
82 double *st=SISL_NULL; /* Pointers used in loop. */
83 double a,b;
84 int ii, kpos=0, kstat=0;
85 if (!pc) goto out;
86
87 if((st = newarray(kk+kn,DOUBLE)) == SISL_NULL) goto err101;
88
89 a = pc -> et[kk-1];
90 b = pc -> et[kn];
91
92 for (ii=0;ii<kn+kk;ii++)
93 st[ii] = astart+(((pc -> et[ii])-a)/(b-a))*(astop-astart);
94 for (ii=0;ii<kn+kk;ii++)
95 pc -> et[ii] = st[ii];
96 goto out;
97
98 /* Error in scratch allocation */
99
100 err101:
101 kstat = -101;
102 s6err("s1399",kstat,kpos);
103 goto out;
104
105 out:
106 if (st != SISL_NULL) freearray(st);
107 return;
108 }
109