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
a483fb6d
Commit
a483fb6d
authored
21 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Fixed 3D cylinder/arrow drawing code when dir vector is // to z-axis
parent
006bb363
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Graphics/Entity.cpp
+19
-10
19 additions, 10 deletions
Graphics/Entity.cpp
Numeric/Numeric.cpp
+9
-9
9 additions, 9 deletions
Numeric/Numeric.cpp
Numeric/Numeric.h
+1
-1
1 addition, 1 deletion
Numeric/Numeric.h
with
29 additions
and
20 deletions
Graphics/Entity.cpp
+
19
−
10
View file @
a483fb6d
// $Id: Entity.cpp,v 1.3
3
2004-04-13 1
8:47:32
geuzaine Exp $
// $Id: Entity.cpp,v 1.3
4
2004-04-13 1
9:27:09
geuzaine Exp $
//
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -56,7 +56,7 @@ void Draw_Sphere(double size, double x, double y, double z, int light)
...
@@ -56,7 +56,7 @@ void Draw_Sphere(double size, double x, double y, double z, int light)
glEndList
();
glEndList
();
}
}
glPushMatrix
();
glPushMatrix
();
glTranslate
f
(
x
,
y
,
z
);
glTranslate
d
(
x
,
y
,
z
);
glScalef
(
s
,
s
,
s
);
glScalef
(
s
,
s
,
s
);
glCallList
(
listnum
);
glCallList
(
listnum
);
glPopMatrix
();
glPopMatrix
();
...
@@ -86,11 +86,16 @@ void Draw_Cylinder(double width, double *x, double *y, double *z, int light)
...
@@ -86,11 +86,16 @@ void Draw_Cylinder(double width, double *x, double *y, double *z, int light)
double
vdir
[
3
]
=
{
dx
/
length
,
dy
/
length
,
dz
/
length
};
double
vdir
[
3
]
=
{
dx
/
length
,
dy
/
length
,
dz
/
length
};
double
axis
[
3
],
cosphi
,
phi
;
double
axis
[
3
],
cosphi
,
phi
;
prodve
(
zdir
,
vdir
,
axis
);
prodve
(
zdir
,
vdir
,
axis
);
norme
(
axis
);
prosca
(
zdir
,
vdir
,
&
cosphi
);
prosca
(
zdir
,
vdir
,
&
cosphi
);
if
(
!
norme
(
axis
)){
axis
[
0
]
=
0.
;
axis
[
1
]
=
1.
;
axis
[
2
]
=
0.
;
}
phi
=
180.
*
myacos
(
cosphi
)
/
M_PI
;
phi
=
180.
*
myacos
(
cosphi
)
/
M_PI
;
glTranslatef
(
x
[
0
],
y
[
0
],
z
[
0
]);
glRotatef
(
phi
,
axis
[
0
],
axis
[
1
],
axis
[
2
]);
glTranslated
(
x
[
0
],
y
[
0
],
z
[
0
]);
glRotated
(
phi
,
axis
[
0
],
axis
[
1
],
axis
[
2
]);
gluCylinder
(
qua
,
radius
,
radius
,
length
,
CTX
.
quadric_subdivisions
,
1
);
gluCylinder
(
qua
,
radius
,
radius
,
length
,
CTX
.
quadric_subdivisions
,
1
);
glPopMatrix
();
glPopMatrix
();
...
@@ -349,18 +354,22 @@ void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadi
...
@@ -349,18 +354,22 @@ void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadi
double
vdir
[
3
]
=
{
dx
/
length
,
dy
/
length
,
dz
/
length
};
double
vdir
[
3
]
=
{
dx
/
length
,
dy
/
length
,
dz
/
length
};
double
axis
[
3
],
cosphi
,
phi
;
double
axis
[
3
],
cosphi
,
phi
;
prodve
(
zdir
,
vdir
,
axis
);
prodve
(
zdir
,
vdir
,
axis
);
norme
(
axis
);
prosca
(
zdir
,
vdir
,
&
cosphi
);
prosca
(
zdir
,
vdir
,
&
cosphi
);
if
(
!
norme
(
axis
)){
axis
[
0
]
=
0.
;
axis
[
1
]
=
1.
;
axis
[
2
]
=
0.
;
}
phi
=
180.
*
myacos
(
cosphi
)
/
M_PI
;
phi
=
180.
*
myacos
(
cosphi
)
/
M_PI
;
glTranslate
f
(
x
,
y
,
z
);
glTranslate
d
(
x
,
y
,
z
);
glRotate
f
(
phi
,
axis
[
0
],
axis
[
1
],
axis
[
2
]);
glRotate
d
(
phi
,
axis
[
0
],
axis
[
1
],
axis
[
2
]);
if
(
head_l
&&
head_r
){
if
(
head_l
&&
head_r
){
glTranslate
f
(
0.
,
0.
,
stem_l
);
glTranslate
d
(
0.
,
0.
,
stem_l
);
gluCylinder
(
qua
,
head_r
,
0.
,
head_l
,
subdiv
,
1
);
gluCylinder
(
qua
,
head_r
,
0.
,
head_l
,
subdiv
,
1
);
gluDisk
(
qua
,
stem_r
,
head_r
,
subdiv
,
1
);
gluDisk
(
qua
,
stem_r
,
head_r
,
subdiv
,
1
);
glTranslate
f
(
0.
,
0.
,
-
stem_l
);
glTranslate
d
(
0.
,
0.
,
-
stem_l
);
}
}
if
(
stem_l
&&
stem_r
){
if
(
stem_l
&&
stem_r
){
...
...
This diff is collapsed.
Click to expand it.
Numeric/Numeric.cpp
+
9
−
9
View file @
a483fb6d
// $Id: Numeric.cpp,v 1.1
2
2004-04-13 1
8:47:32
geuzaine Exp $
// $Id: Numeric.cpp,v 1.1
3
2004-04-13 1
9:27:09
geuzaine Exp $
//
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -106,16 +106,16 @@ void prosca(double a[3], double b[3], double *c)
...
@@ -106,16 +106,16 @@ void prosca(double a[3], double b[3], double *c)
*
c
=
a
[
0
]
*
b
[
0
]
+
a
[
1
]
*
b
[
1
]
+
a
[
2
]
*
b
[
2
];
*
c
=
a
[
0
]
*
b
[
0
]
+
a
[
1
]
*
b
[
1
]
+
a
[
2
]
*
b
[
2
];
}
}
void
norme
(
double
a
[
3
])
double
norme
(
double
a
[
3
])
{
{
double
mod
;
double
mod
=
sqrt
(
a
[
0
]
*
a
[
0
]
+
a
[
1
]
*
a
[
1
]
+
a
[
2
]
*
a
[
2
]);
mod
=
sqrt
(
a
[
0
]
*
a
[
0
]
+
a
[
1
]
*
a
[
1
]
+
a
[
2
]
*
a
[
2
]);
if
(
mod
!=
0.0
){
if
(
mod
==
0.0
)
return
;
a
[
0
]
/=
mod
;
a
[
0
]
/=
mod
;
a
[
1
]
/=
mod
;
a
[
1
]
/=
mod
;
a
[
2
]
/=
mod
;
a
[
2
]
/=
mod
;
}
}
return
mod
;
}
int
sys2x2
(
double
mat
[
2
][
2
],
double
b
[
2
],
double
res
[
2
])
int
sys2x2
(
double
mat
[
2
][
2
],
double
b
[
2
],
double
res
[
2
])
{
{
...
...
This diff is collapsed.
Click to expand it.
Numeric/Numeric.h
+
1
−
1
View file @
a483fb6d
...
@@ -61,7 +61,7 @@ double myasin(double a);
...
@@ -61,7 +61,7 @@ double myasin(double a);
double
myacos
(
double
a
);
double
myacos
(
double
a
);
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]);
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]);
void
prosca
(
double
a
[
3
],
double
b
[
3
],
double
*
c
);
void
prosca
(
double
a
[
3
],
double
b
[
3
],
double
*
c
);
void
norme
(
double
a
[
3
]);
double
norme
(
double
a
[
3
]);
int
sys2x2
(
double
mat
[
2
][
2
],
double
b
[
2
],
double
res
[
2
]);
int
sys2x2
(
double
mat
[
2
][
2
],
double
b
[
2
],
double
res
[
2
]);
int
sys3x3
(
double
mat
[
3
][
3
],
double
b
[
3
],
double
res
[
3
],
double
*
det
);
int
sys3x3
(
double
mat
[
3
][
3
],
double
b
[
3
],
double
res
[
3
],
double
*
det
);
int
sys3x3_with_tol
(
double
mat
[
3
][
3
],
double
b
[
3
],
double
res
[
3
],
double
*
det
);
int
sys3x3_with_tol
(
double
mat
[
3
][
3
],
double
b
[
3
],
double
res
[
3
],
double
*
det
);
...
...
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