FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arrayfire/examples/graphics/surface.cpp at feature/optional-graphics · arrayfire/arrayfire · GitHub
arrayfire
arrayfire
Repository navigation
Code
Issues
292
(292)
Pull requests
39
(39)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
arrayfire
/
examples
/
graphics
/
surface.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (35 loc) · 1.17 KB
Breadcrumbs
arrayfire
/
examples
/
graphics
/
surface.cpp
Copy path
File metadata and controls
42 lines (35 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
*******************************************************
*/
#
include
<
arrayfire.h
>
#
include
<
math.h
>
#
include
<
cstdio
>
using
namespace
af
;
static
const
int
M =
30
;
static
const
int
N =
2
* M;
int
main
(
int
,
char
**) {
try
{
//
Initialize the kernel array just once
af::info
();
af::Window
myWindow
(
800
,
800
,
"
3D Surface example: ArrayFire
"
);
//
Creates grid of between [-1 1] with precision of 1 / M
const
array x =
iota
(
dim4
(N,
1
),
dim4
(
1
, N)) / M -
1
;
const
array y =
iota
(
dim4
(
1
, N),
dim4
(N,
1
)) / M -
1
;
static
float
t =
0
;
while
(!myWindow.
close
()) {
t +=
0.07
;
array z =
10
* x * -
abs
(y) *
cos
(x * x * (y + t)) +
sin
(y * (x + t)) -
1.5
;
myWindow.
surface
(x, y, z);
}
}
catch
(af::exception& e) {
fprintf
(stderr,
"
%s
\n
"
, e.
what
());
throw
;
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL