Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
b1631dac
Commit
b1631dac
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
limit char in [-127,127]
parent
c8d482d7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Numeric/Numeric.cpp
+10
-6
10 additions, 6 deletions
Numeric/Numeric.cpp
with
10 additions
and
6 deletions
Numeric/Numeric.cpp
+
10
−
6
View file @
b1631dac
// $Id: Numeric.cpp,v 1.3
4
2007-10-25
08
:5
5
:0
7
geuzaine Exp $
// $Id: Numeric.cpp,v 1.3
5
2007-10-25
19
:5
4
:0
6
geuzaine Exp $
//
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -433,16 +433,20 @@ double triangle_area(double p0[3], double p1[3], double p2[3])
...
@@ -433,16 +433,20 @@ double triangle_area(double p0[3], double p1[3], double p2[3])
char
float2char
(
float
f
)
char
float2char
(
float
f
)
{
{
// f is supposed to be normalized in [-1, 1]
// float normalized in [-1, 1], char in [-127, 127]
f
=
(
f
>
1.
)
?
1.
:
(
f
<
-
1.
)
?
-
1.
:
f
;
f
*=
127.
;
// char is in [-128, 127]
if
(
f
>
127.
)
return
127
;
return
(
char
)(
-
128
+
(
f
+
1.
)
/
2.
*
255
);
else
if
(
f
<
-
127.
)
return
-
127
;
else
return
(
char
)
f
;
}
}
float
char2float
(
char
c
)
float
char2float
(
char
c
)
{
{
float
f
=
c
;
float
f
=
c
;
return
-
1.
+
2.
*
(
f
+
128.
)
/
255.
;
f
/=
127.
;
if
(
f
>
1.
)
return
1.
;
else
if
(
f
<
-
1
)
return
-
1.
;
else
return
f
;
}
}
double
InterpolateIso
(
double
*
X
,
double
*
Y
,
double
*
Z
,
double
InterpolateIso
(
double
*
X
,
double
*
Y
,
double
*
Z
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment