Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
dbbd6e40
Commit
dbbd6e40
authored
Mar 10, 2008
by
peud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add: Arc and Circle item drawing at PCB copper layers (edge) in 3D_Viewer.
parent
e724e4fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
1 deletion
+64
-1
3d_draw.cpp
3d-viewer/3d_draw.cpp
+64
-1
No files found.
3d-viewer/3d_draw.cpp
View file @
dbbd6e40
...
@@ -43,6 +43,10 @@ static void Draw3D_FilledSegmentWithHole( double startx,
...
@@ -43,6 +43,10 @@ static void Draw3D_FilledSegmentWithHole( double startx,
double
holey
,
double
holey
,
double
holeradius
,
double
holeradius
,
double
zpos
);
double
zpos
);
static
void
Draw3D_ArcSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
);
static
void
Draw3D_CircleSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
);
/******************************************/
/******************************************/
...
@@ -321,7 +325,18 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
...
@@ -321,7 +325,18 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
{
{
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
Draw3D_FilledSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
switch
(
segment
->
m_Shape
)
{
case
S_ARC
:
Draw3D_ArcSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
break
;
case
S_CIRCLE
:
Draw3D_CircleSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
break
;
default
:
Draw3D_FilledSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
break
;
}
}
}
}
}
else
else
...
@@ -883,3 +898,51 @@ static void Draw3D_FilledSegmentWithHole( double startx,
...
@@ -883,3 +898,51 @@ static void Draw3D_FilledSegmentWithHole( double startx,
glVertex3f
(
firstx
,
firsty
,
zpos
);
glVertex3f
(
firstx
,
firsty
,
zpos
);
glEnd
();
glEnd
();
}
}
/********************************************************/
static
void
Draw3D_ArcSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
)
{
int
ii
,
slice
=
36
;
double
x
,
y
,
hole
,
rayon
;
int
angle
;
angle
=
static_cast
<
int
>
(
atan2
(
startx
-
endx
,
starty
-
endy
)
*
1800
/
M_PI
)
+
900
;
rayon
=
hypot
(
startx
-
endx
,
starty
-
endy
)
+
(
width
/
2
);
hole
=
rayon
-
width
;
glBegin
(
GL_QUAD_STRIP
);
for
(
ii
=
0
;
ii
<=
slice
/
4
;
ii
++
)
{
x
=
hole
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
angle
+
(
ii
*
3600
/
slice
));
glVertex3f
(
x
+
startx
,
y
+
starty
,
zpos
);
x
=
rayon
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
angle
+
(
ii
*
3600
/
slice
));
glVertex3f
(
x
+
startx
,
y
+
starty
,
zpos
);
}
glEnd
();
}
/********************************************************/
static
void
Draw3D_CircleSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
)
{
int
ii
,
slice
=
36
;
double
x
,
y
,
hole
,
rayon
;
rayon
=
hypot
(
startx
-
endx
,
starty
-
endy
)
+
(
width
/
2
);
hole
=
rayon
-
width
;
glBegin
(
GL_QUAD_STRIP
);
for
(
ii
=
0
;
ii
<=
slice
;
ii
++
)
{
x
=
hole
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
ii
*
3600
/
slice
);
glVertex3f
(
x
+
startx
,
y
+
starty
,
zpos
);
x
=
rayon
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
ii
*
3600
/
slice
);
glVertex3f
(
x
+
startx
,
y
+
starty
,
zpos
);
}
glEnd
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment