2D/3D view
Class documentation
Bases: QWidget
A class representing a spatial view widget.
Attributes:
| Name | Type | Description |
|---|---|---|
graphWidget |
PlotWidget
|
A PlotWidget for 2D plots. |
fig |
Figure
|
A Figure object for 3D plots. |
canvas |
FigureCanvasQTAgg
|
A FigureCanvas for displaying the 3D plot. |
axes |
Axes3D
|
Axes for 3D plot. |
prm |
PRM
|
An instance of PRM class. |
a_ref |
float
|
Reference angle in degrees |
home_pos |
dict
|
Dictionary containing home position coordinates. |
ref_circle |
ndarray
|
Array containing points of reference circle. |
m2 |
ndarray
|
Array containing points of mirror 2 projected onto the wall of the observatory |
m1 |
ndarray
|
Array containing points of mirror 1 turned and projected onto the wall of the observatory |
Source code in GUI.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
__init__()
Initialize the SpatialView widget.
Loads the UI file, initializes 2D and 3D plots, and sets up initial parameters.
Source code in GUI.py
plot_line(p1, p2, color)
Plot a line in the 3D plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1 |
ndarray
|
Starting point of the line. |
required |
p2 |
ndarray
|
Ending point of the line. |
required |
color |
str
|
Color of the line. |
required |
Source code in GUI.py
plot_mirror(P, n, r, nn, color)
Plot a mirror in the 3D plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P |
ndarray
|
Center point of the mirror. |
required |
n |
ndarray
|
Normal vector of the mirror. |
required |
r |
float
|
Radius of the mirror. |
required |
nn |
int
|
Number of points to generate on the mirror. |
required |
color |
str
|
Color of the mirror. |
required |
Source code in GUI.py
plot_vector(p1, p2)
Plot a vector in the 3D plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1 |
ndarray
|
Starting point of the vector. |
required |
p2 |
ndarray
|
Ending point of the vector. |
required |
Source code in GUI.py
set_axes_equal(ax)
Make axes of 3D plot have equal scale so that spheres appear as spheres, cubes as cubes, etc.
Input ax: a matplotlib axis, e.g., as output from plt.gca().
Source code in GUI.py
update_view_plot(pos)
Update the view plot based on the new position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos |
dict
|
Dictionary containing the new position coordinates. |
required |
This method updates the position of the mirrors and other elements in the view plot based on the new position. It clears the 3D plot, plots mirrors, normal vectors, vectors from the sun, and lines from M1 to M2 and to the house. It also sets the axes equal for better visualization.
Additionally, it updates the 2D plot by projecting M1.