LIBEUNOMIA
読み取り中…
検索中…
一致する文字列を見つけられません
pict_magnify_func.h
[詳解]
1/*
2 * Copyright 2003-2021 oZ/acy (名賀月晃嗣)
3 * Redistribution and use in source and binary forms,
4 * with or without modification,
5 * are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
27/*
28 * @author oZ/acy (名賀月晃嗣)
29 * @brief Picture::magnify()とPictureRgba::magnify()の共用函數の實裝
30 *
31 * @date 24 Apr MMXXI
32 * Picture::magnify()、PictureRgba::magnify()で共用する函數を摘出
33 *
34 */
35#ifndef INCLUDE_GUARD_EUNOMIA_PICTURE_MAGNIFY_FUNCTION_H
36#define INCLUDE_GUARD_EUNOMIA_PICTURE_MAGNIFY_FUNCTION_H
37
38
39namespace eunomia::implement_
40{
41
42// aの追加はWikipedia:en:Bicubic interpolationに據る。(R3.4.23)
43// 從前は a = -1.0 固定であつた。
44inline
45double fCubic_(double t, double a)
46{
47 if (t < 0)
48 t = -t;
49
50 if (t < 1.0)
51 return 1.0 + t * t * ((a + 2.0) * t - a - 3.0);
52 //return t * t * (t - 2.0) + 1.0;
53 else if (t < 2.0)
54 return a * (t * (t * (t - 5.0) + 8.0) - 4.0);
55 //return -t * (t * (t - 5.0) + 8.0) + 4.0;
56 else
57 return 0.0;
58}
59
60inline
61double innerProduct_(int n, double* x, double* y)
62{
63 double res = 0.0;
64 for (int i=0; i < n; i++)
65 res += x[i] * y[i];
66 return res;
67}
68
69inline
70void productMat14_44_(double* res, double* vec, double* mat)
71{
72 for (int i = 0; i < 4; i++) {
73 res[i] = 0.0;
74 for (int j = 0; j < 4; j++)
75 res[i] += vec[j] * mat[i + j * 4];
76 }
77}
78
79
80}// end of namespace eunomia::implement_
81
82
83
84
85#endif // INCLUDE_GUARD_EUNOMIA_PICTURE_MAGNIFY_FUNCTION_H
畫像バッファ基底クラステンプレート
Definition imagebuffer.h:84
Definition ibuf_blt.h:39
double innerProduct_(int n, double *x, double *y)
Definition pict_magnify_func.h:61
double fCubic_(double t, double a)
Definition pict_magnify_func.h:45
void productMat14_44_(double *res, double *vec, double *mat)
Definition pict_magnify_func.h:70