An Interactive User Interface For A Structural Analysissoftware Using Computer Graphics Techniques in MATLAB - 202

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Received: 15 June 2020 | Revised: 29 December 2020 | Accepted: 18 February 2021

DOI: 10.1002/cae.22406

RESEARCH ARTICLE

An interactive user interface for a structural analysis


software using computer graphics techniques in MATLAB

Pedro C. Lopes1 | Rafael L. Rangel2 | Luiz F. Martha3

1
Institute of Computing, Fluminense
Federal University, Niterói, RJ, Brazil Abstract
2
International Center for Numerical This paper presents an interactive graphics tool for the structural analysis of
Methods in Engineering (CIMNE), one‐dimensional element models, such as trusses, frames, and grillages. The
Universitat Politècnica de Catalunya,
Barcelona, Spain focus is on the creation of a graphical user interface for a previously developed
3
Department of Civil and Environmental analysis solver. This graphical interface is entirely implemented in the MA-
Engineering, Pontifical Catholic TLAB environment and features intuitive resources so that modeling and
University of Rio de Janeiro, Rio de
verification of results become easy tasks for students and engineers. The
Janeiro, RJ, Brazil
management of mouse events and the adopted solutions to basic computer
Correspondence graphics issues that arise from interactive modeling in two‐dimensional and
Luiz F. Martha, Department of Civil and
Environmental Engineering, Pontifical
three‐dimensional canvases are discussed, including the strategies to pick
Catholic University of Rio de Janeiro, Rua objects in spatial coordinates and to identify crossing elements. The result is a
Marquês de São Vicente 225, Gávea, Rio de new educational software that proved to be a very useful application in
Janeiro, RJ 22451‐900, Brazil.
Email: lfm@tecgraf.puc-rio.br structural analysis and introductory computer graphics courses for engineer-
ing. The article also presents examples of using the software as an educa-
Funding information
tional tool.
Coordenação de Aperfeiçoamento de
Pessoal de Nível Superior – Brasil
KEYWORDS
(CAPES), Grant/Award Number: Finance
Code 001 educational software, GUI development, interactive graphics application, MATLAB program,
structural analysis

1 | INTRODUCTION A good interface of a structural analysis program should


provide users with the possibility to create and manip-
When developing computational mechanics programs ulate structural models, set all analysis options, run the
intended to be used by a large number of people, for simulation, and visualize and investigate the results.
research, professional, or educational purposes, it is a However, developing an efficient and robust GUI is
good practice to invest in the creation of a graphical user not a simple task. In a typical graphical application, the
interface (GUI). A GUI is essential to provide a good code related to the user interface usually accounts for
communication between the user of a computer program more than half of all code [7,15]. Among the main
and the source code. It allows data input and output challenges is the design of a user‐friendly, effective, and
through interactive graphical components, generically organized layout with intuitive commands, which falls in
referred to as widgets, such as menus, buttons, text fields, the field of interaction design [9,26,36]. As users are free
canvases, and so forth, which can be displayed in dialog to interact with the interface in unpredictable ways, the
windows on the screen of a computer. The most common management and control of users' activities are pri-
way to manipulate and interact with these widgets is to mordial to eliminate any possibility of conflicting or
use mouse and keyboard devices. The goal is to make the harmful procedures that can lead to mistakes. The data
use of computer systems easier and more productive. transmission between the interface inputs and the

Comput Appl Eng Educ. 2021;1–21. wileyonlinelibrary.com/journal/cae © 2021 Wiley Periodicals LLC | 1
2 | C. LOPES ET AL.

analysis solver must also be handled with care. Further- idealized to have a similar behavior as the well‐known
more, modeling and visualization of structural mechan- OpenGL API used in graphical applications developed,
ical models on the computer screen requires techniques for example, with the Qt framework [30]. The idea is to
of computer graphics [17,21,32,33], computational geo- allow developers to bypass the idiosyncrasies of the
metry [11,13,27,29], and solid modeling [16,20]. MATLAB Axes widget and work with a class that better
In this regard, MATLAB proves to be very useful for resembles a conventional GUI canvas. The sophisticated
developing graphical applications, due to its practicality plotting functions and graphic resources of MATLAB
provided by a high‐level programming language and an made it possible to deal with these topics in a simple way.
extensive variety of powerful toolboxes and graphic As a consequence, the program has also been used in
functionalities. Therefore, it is often used for developing basic computer graphics courses for engineering at PUC‐
graphical tools for engineering modeling and simulations Rio. The installer and the complete source code of the
focused on educational aspects [3,5,6,19]. There can be program are available for free on its website.1
also found GUI applications, and even more powerful In summary, the main hypotheses considered in this
software, intended to perform structural analyses or study are that the use of interactive graphics programs
multiphysics simulations that make it possible for users and the exposure to their source code are efficient pro-
to interact with the program and visualize models and cedures for teaching structural mechanics and computer
results in efficient ways [2,14,24,34]. Studies have been graphics. Two types of students are considered: Under-
developed for assessing and comparing various other graduate students who act as end‐users to learn structural
tools that can be used for building GUIs [12] for the analysis methodologies and graduate students in com-
growing trend of mobile applications [1,35]. puter graphics courses who are introduced to the devel-
This study presents a graphical version of the LESM opment of interactive graphical interfaces to simulate
(Linear Elements Structure Model) program [31], devel- structural mechanics problems. As mentioned in the
oped at the Institute of Technical‐Scientific Software previous paragraphs, the assumptions are as follows:
Development of Pontifical Catholic University of Rio de
Janeiro (Tecgraf/PUC‐Rio). This program is fully open • An active graphical interface is important for educa-
source and was conceived as a nongraphic tool for linear tional structural analysis programs.
elastic analysis of one‐dimensional element models, such • The development of a graphical interface is a challen-
as two‐/three‐dimensional (2D/3D) trusses and frames, ging task because it is multidisciplinary.
and grillages. The focus of the first version is to provide a • The development environment provided by MATLAB
didactic and well‐documented source code to introduce makes this task feasible, especially for engineering
students to the computational implementation of struc- students with little programming experience.
tural analysis methods. It was the theme of a book on
matrix structural analysis [23], and it is currently being The article describes strategies for implementing the
used on related courses at PUC‐Rio. The main goal of the interactive graphic interface of LESM and presents
present paper is to show important aspects of creating a feedback from the two student groups involved in the
user interface, with a canvas and mouse modeling cap- educational methodology adopted.
abilities. This is accomplished in an educational context, Section 2 of this paper brings an overview of the
where engineering students are encouraged to go through LESM program: Its structural analysis features and a
some essential steps of building a graphical tool in description of the developed GUI. Section 3 presents the
MATLAB. management of canvas functionalities using OOP classes
The purpose of the new graphical version of LESM is to handle the MATLAB Axes behavior and mouse inter-
to allow the practical usage of the software. Therefore, an actions. Section 4 depicts the important notions of com-
easy‐to‐use GUI with multiple functionalities was devel- putational geometry used for modeling on LESM.
oped in MATLAB. An important feature is the mouse Section 5 shows examples of models and results achieved
interaction with canvas to draw model geometry and with the program. Section 6 aims to discuss the educa-
define topology, pick objects in a 3D space, and manip- tional scope under which the new version of LESM is
ulate camera visualization. This is done by using a gen- being used. Section 7 presents feedback from students
eric object‐oriented programming (OOP) class that who used LESM in undergraduate and graduate courses
manages mouse events [37], combined with the im- at PUC‐Rio. Finally, Section 8 gives some concluding
plementation of computer graphics and computational remarks and points toward future developments.
geometry algorithms that allow users to manipulate 2D
and 3D models. Another significant aspect of the pro-
1
gram is the use of an OOP class for canvas management, www.tecgraf.puc-rio.br/lesm
C. LOPES ET AL. | 3

2 | THE LESM PROGRAM • Load types: Each load case may include concentrated
forces or moments applied to nodes, uniformly or linearly
The entire source code of LESM is written in the MA- distributed forces applied over the entire length of an
TLAB programming language. The code is divided into element, thermal gradient, and prescribed displacement
two main parts, the analysis solver and GUI‐related files. set to a degree‐of‐freedom fixed by rigid support. Multiple
The analysis solver is the core of the software. It load cases can be combined with multiplication factors.
consists of a set of files responsible for receiving model
information and computing the analysis results. In the
LESM program, the structural analysis is performed ac- 2.2 | Graphical user interface
cording to the Direct Stiffness Method, a displacement‐
based Finite Element Method for bar and beam elements The toolkits for developing GUIs integrate the task of
[25]. Its implementation is fully based on the OOP para- laying out widgets with the task of programming their
digm [10], exploring concepts of inheritance, abstraction, behavior. The layout is usually built by visually placing
and polymorphism to enhance the code modularity and and editing the widgets in the dialogs, but it can also be
the educational aspect. A detailed description of the done programmatically, using only code lines to define
analysis solver of the LESM program and the OOP class their position, attributes, and characteristics. The beha-
architecture is presented in References [31] and [23]. vior of widgets is programmed according to the concept
The GUI‐related files are those responsible for any of event‐driven programming, in which a specific func-
graphical functionality: construction of dialogs, manage- tion, commonly named callback function, is written by
ment of interface behavior, drawing objects on canvas, the developer and designated to be triggered upon the
and control of mouse actions on canvas. These tasks are occurrence of a certain event, which is essentially any
the focus of this paper and they will be discussed in the action taken by the user: Clicking on a button, selecting
remainder of this section and in the following sections. an option from a menu, moving the cursor, and so forth.
The graphical interface of LESM was created using
the Graphical User Interface Development Environment
2.1 | Structural analysis features (GUIDE) of MATLAB [18], a drag‐and‐drop toolkit for
visually laying out widgets in dialog windows. The GUI
To address the graphic characteristics of the LESM pro- was designed to provide a simple and clear workflow for
gram, it is important to briefly mention its analysis op- the structural analysis process, with easily identified and
tions and features first. They are summarized next, with sequentially displayed widgets. Figure 1 presents the
further details also found in References [31] and [23]: main dialog window of the LESM program showing a 3D
frame model in the canvas.
• Analysis type: Linear elastic analysis considering static On the left‐hand side of the GUI, below the program's
behavior of structural models made of one‐dimensional logo, there is a modeling panel, from which users can
elements (prismatic bars and beams). create the structural model. First, it is requested to select
• Model types: Planar and spatial trusses made of bar the model type and the current load case scenario, via
elements (axial behavior only); Planar and spatial drop‐down lists. Next, all model input data can be pro-
frames made of beam elements (axial and bending vided in auxiliary dialog windows that are popped up
behaviors in 2D, plus torsional behavior in 3D); Gril- when clicking on the corresponding buttons. In these
lages made of beam elements (bending in out‐of‐plane auxiliary modeling dialogs (not shown here for practi-
direction and torsional behaviors). cality), users are supposed to create materials and cross‐
• Beam types: Euler–Bernoulli and Timoshenko theories sections, set the coordinates of each node, create
can be assumed for the bending behavior of beam elements by setting their material, cross‐section, bending
elements in frame and grillage models. theory, connectivity and nodal incidence, create and ap-
• Materials: All properties are homogeneous and iso- ply loads, and define support conditions. When using the
tropic and a linear elastic behavior is assumed with no auxiliary modeling dialogs, all geometric and topological
limit of resistance. information must be entered via the keyboard. As
• Element connectivity: Truss elements are connected by the data are provided, the graphic representation of the
flexible joints (hinges); frame and grillage elements may model is updated on canvas. The matter of drawing the
be connected by rigid, linear semi‐rigid, or flexible joints. model on canvas is tackled in Section 3.1.
• Support conditions: Rigid or spring supports may be A button to process the input data, that is, run the
assigned to each node in global degree‐of‐freedom di- structural analysis, is positioned below the modeling panel.
rections or in any arbitrary direction. It calls the analysis solver and if the model is stable and the
4 | C. LOPES ET AL.

FIGURE 1 The main dialog window of the Linear Elements Structure Model (LESM) program with a three‐dimensional frame
model

analysis is successfully performed, the results become Finally, a toolbar is located below the configuration
available in the panel below. The displayed result options menus, with two groups of functionalities. The first group
include diagrams of deformed configuration and internal consists of actions related to model visualization (mainly
forces (axial force, shear force, bending moment, or torsion camera manipulation), such as panning, zooming, rotat-
moment), which can have the scale adjusted, as well as ing, and fitting model to screen. The second group con-
support reactions. To complement the left‐hand side menu, sists of mouse modeling options. These options allow
two tables are placed right below the results panel, an in- users to define the geometry and topology of the model
formation table, and an editing table. The former gives using the mouse on canvas, instead of entering input data
general information about the whole model or about an via keyboard in the auxiliary modeling dialogs. It is
element or node picked from the model draw. The latter possible to insert and delete nodes and elements, from 2D
allows users to edit some properties of the selected element and 3D models, through mouse actions. Some auxiliary
or node. Editing model properties can also be done in the features are available to help users drawing the model:
auxiliary modeling dialogs, which dispose editable lists of Enable snap‐to‐grid behavior of the cursor, draw poly-
the created materials, cross‐sections, nodes, elements, loads, lines, and force elements to be orthogonal. The matter of
and so forth. After any change to the model, the results mouse interaction on canvas is discussed in Section 3.2.
become unavailable until the analysis is successfully per- The computer graphics strategies for picking objects in a
formed again. 3D canvas and evaluating the intersection and colli-
At the top of the dialog, configuration menus are nearity of elements in both 2D and 3D models are ad-
available. The File menu allows users to save the current dressed in Section 4.
model, load a model file, or open an empty model. The
View menu provides displaying options, such as enabling or
disabling the grid and ruler of the canvas, showing or 3 | THE CANVAS
hiding the units of measure and the nodes/elements iden-
tification numbers, setting the visualization plane, and The canvas of a structural analysis program is an area of
so on. the GUI where the model is graphically represented and
C. LOPES ET AL. | 5

users may have the opportunity to interact with it. In Axes widget with a natural behavior for drawing graphic
MATLAB, a widget called Axes can be used as a canvas primitives in an arbitrary way. Most interface toolkits
for graphical applications. This component defines the feature a widget for this purpose. An example is the
area where the graphics system of the computer can plot QGLWidget widget from the Qt framework for creating a
geometric primitives, such as points, lines, and polygons, canvas that uses the OpenGL graphics system. The
which are used to display the structural model and the Canvas class is an abstract superclass whose intrinsic
analysis results. A great advantage of using the MATLAB property is an Axes widget. The Canvas superclass en-
Axes is the natural treatment of three‐dimensional plots capsulates all the procedures necessary to associate the
and camera view, without the need to use low‐level behavior of a generic canvas with the Axes widget. This
computer graphics techniques to create perspective ef- superclass declares abstract methods that associate call-
fects. When set to 3D, the Axes takes the aspect of a back functions with basic canvas actions: Resizing, re-
“plotting box,” instead of a plane area, which auto- paint, and so forth. A client subclass must be inherited
matically creates the perspective effects. from the Canvas class for implementing the abstract
methods according to the necessities of the client
application.
3.1 | Drawing models on Canvas The Canvas class has a scope that goes beyond its use
in the LESM program. It was designed to be used inter-
To draw the components of the graphical representation changeably by any program developed in MATLAB that
of a structural model (nodes, elements, supports, and needs a widget for arbitrary drawing of graphic primi-
loads) and its results (deformed configuration, diagrams, tives. It is beyond the scope of this study to detail the
and support reactions), a new superclass, in the context Canvas class. However, the source code and doc-
of the OOP, was added to the program's architecture. umentation for this class, including simple examples of
This superclass, called Draw class, declares abstract its use, are available in a repository on GitLab2 and on
methods that are implemented in its subclasses (one MathWorks File Exchange.3
subclass for each analysis model type). In the im- To manage canvas callback functions of the LESM
plementation of the abstract methods, MATLAB plotting program, two subclasses were inherited from the Canvas
functions are called to draw a model or result component class, one for dealing with 2D models (Canvas_2D) and
according to how this component is graphically re- another for dealing with 3D models (Canvas_3D).
presented in the corresponding model type (e.g., a node is
represented as a small square in a 2D model and as a
small cube in a 3D model). 3.2 | Mouse interactions on canvas
An important point to note is that the MATLAB Axes
widget was originally designed to draw graphs of differ- The processes of modeling and camera control on LESM
ent types with coordinate axes to express how certain are aided by mouse interactions with the canvas. These
parameters vary with others. It implies that the Axes interactions are carried out through mouse events, such
widget was not designed to draw arbitrary graphic pri- as click, hoover, drag, and scroll, to perform the desired
mitives (lines, curves, polygons, meshes, etc.) as a generic tasks of modeling (insert and pick objects, for example)
drawing area; however, this is possible. This brings some and camera manipulation (panning, zooming, and ro-
disadvantages regarding the use of the Axes widget when tating). Although in the current MATLAB version, cam-
the objective is to have a canvas for generic design of era control can be executed with mouse actions, it was
geometric models, as is the case of a structural model. For not possible in previous versions.
example, the Axes widget has the natural behavior of The program handles mouse events by using the
updating the drawing scale when its dimensions are Emouse class [37], an OOP superclass developed to
changed. This is not a natural behavior when the goal is manage mouse actions on a MATLAB canvas (Axes
to draw graphic primitives on a generic canvas. The de- widget), in a generic way. This superclass declares ab-
sired behavior for a generic canvas can be achieved using stract methods that associate callback functions with
the Axes widget, but some specific procedures must be basic mouse actions: Pressing a mouse button, releasing a
performed. It should be noted that there is no other al- mouse button, moving the cursor, and so forth. Similar to
ternative in the MATLAB environment: The widget clo- the use of the Canvas class, a client subclass must be
sest to a generic canvas is the Axes.
An important contribution of this study is the devel-
opment of the Canvas class (in the context of OOP) in 2
www.gitlab.com/cortezpedro/canvas
3
MATLAB. The purpose of this class is to associate the www.mathworks.com/matlabcentral/fileexchange/76872-canvas-tool
6 | C. LOPES ET AL.

inherited from the Emouse class for implementing the modeling plane structures from an oblique view (the case
abstract methods according to the necessities of the client of grillage models) are some other issues to be addressed.
application. Most of the complexity of handling mouse The adopted solution for these issues is based on a type of
events on canvas is dealt with by concrete methods of the the so‐called ray casting algorithm devised for volume
Emouse class. The client subclass only needs to address visualization [4], explained in Section 4.3.
what is specific to its application. The Emouse class is
included in the aforementioned Canvas class application.
To manage mouse events on the canvas of LESM, two 4.1 | Signed area of triangles
subclasses were inherited from the Emouse class, one for
dealing with 2D models (Emouse_2D) and another for Finding an intersection and evaluating a possible colli-
dealing with 3D models (Emouse_3D). In addition, two nearity between line segments in a 2D canvas are key
auxiliary function files are attached to them (auxMou- factors in any geometric modeling tool. Figure 3 shows
seFctn and auxModelFctn) to perform geometry checks the case of a new element that intersects an existing
and implement common functions that may need to be element, where the red dashed line, symbolizing the new
called multiple times when modeling. In summary, an element, is being inserted by mouse clicks in the in-
Emouse object recognizes that a mouse event has oc- dicated positions. In this case, users should have a clear
curred on the canvas and calls an abstract method, im- option to either place a node on the intersection or leave
plemented by the client subclass, which calls auxiliary it “unsolved” (useful when modeling the simplified 2D
functions to do tasks according to the conditions of the behavior of actual 3D structures). If the user desires to
event (see Figure 2). consider the intersection between crossing elements, the
intersection point must be identified, so that the model is
tessellated in a proper fashion. Figure 4 illustrates the
4 | COMP U TE R G RA PH ICS issue with collinear elements, in which a new element is
T ECHNIQ U E S overlapping the existing elements with numbers 1 and 2.
To maintain consistency, two new elements, with num-
Once interactive mouse modeling is enabled, computa- bers 3 and 4, must be created, as there can be no elements
tional geometry issues arise. All geometric input must be superimposed to others. Therefore, the collinearity of the
tested to be sewn into the model without violating its geometric input with existing elements must also be
topological consistency. An important question faced is checked when adding elements to the model. These
how to evaluate the intersection and collinearity of ele- verifications, in 2D, are made based on the signed area of
ments. To deal with this issue, two techniques were triangles [27].
employed, both aiming to determine the relative position The signed area of triangles, which consists of an area
between two elements. In 2D, verifications of this kind value associated with its orientation, is used to evaluate
are made by computing the signed area of triangles the position of a given point relative to a line segment. It
formed by the endpoints of two line segments, as shown is computed with Equation (1), where ( Ax , Ay ) and (Bx ,B y )
in Section 4.1. In 3D, the shortest orthogonal distance are the endpoint coordinates of a line segment AB in the
between two segments is evaluated in a process described XY plane and (Cx ,Cy ) are the coordinates of a given point
in Section 4.2. Picking objects in a 3D canvas and C in the same plane. The area value SABC is positive if C is

FIGURE 2 Classes and files that manage the response to mouse events on canvas
C. LOPES ET AL. | 7

F I G U R E 3 (a) Insertion of a new element intersecting an existing element. (b) Unsolved intersection between elements.
(c) Elements subdivision to consider the intersection point as a node

FIGURE 4 Insertion of a new element collinear to existing elements

on the left‐hand side of AB , negative if C is on the right‐ position of one segment to another. The segment CD can
hand side of AB , and null if C is collinear to AB (see be above, below, on the right‐hand side, on the left‐hand
Figure 5): side, collinear, or intersecting AB . The last case is split in
five: CD may be passing through point A or B ; AB may be
Ax Ay 1 passing through point C or D; AB and CD may have an
1 (1) intersection point P . These cases can be tested with a
SABC = Bx B y 1 .
2 simple if‐else structure based on the values of the signed
Cx Cy 1
areas, as described by the MATLAB function presented in
The relative position between two line segments is Appendix A that receives the endpoints of two line seg-
determined by analyzing the signed areas of the triangles ments and returns the intersection point P or an empty
delimited by the endpoints, as presented in Figure 6: SABC variable if segments do not intersect.
(in blue), SABD (in yellow), SCDA (in red), and SCDB (in If it is identified that the signed areas are null, within
green). There are 10 possible cases regarding the relative a numerical tolerance, collinearity must be checked by
verifying whether the endpoints of one segment are be-
tween the endpoints of the other, according to their co-
ordinates. If it is verified that AB and CD have an

F I G U R E 5 The signed area of a triangle delimited by a line


segment and a given point FIGURE 6 Intersection between two line segments
8 | C. LOPES ET AL.

intersection point P , its position is found by computing


the local parametric coordinate within AB , as in Equa-
tion (2), where tAB is limited to [0,1] and tAB = 0 means
that P = A, where as tAB = 1 yields P = B :

SCDA (2)
tAB = .
SCDA − SCDB

It is also necessary to determine if a given point is


located inside a line that composes the geometry of the
model within a numerical tolerance. This is used, for
example, to insert nodes that split existing elements and
to pick elements via mouse clicks on canvas. Using the
absolute value of the triangle area, the orthogonal dis-
tance of a certain point C from the line segment AB ,
FIGURE 7 Orthogonal distance between line segments in
denoted as dC , is computed with Equation (3). If the
space
distance is small enough and the projection of C in the
⎯⎯⎯⎯→
direction of AB is inside segment AB (as in Figure 5), it
is admitted that C is, in fact, located on AB : By rearranging the terms of Equation (6), it is possible
to write it as the linear system of equations in Equation
2 SABC (3) (7), whose unknowns are tAB , tCD , and L. This system is
dC = ⎯⎯⎯⎯→ .
‖ AB ‖ presented in a more intuitive form in Equation (8), where
each vector is expressed in terms of the components re-
4.2 | Orthogonal distance in space lative to Cartesian axes XYZ:

When modeling on a 3D canvas, the verifications of ⎯⎯⎯⎯→ ⎯⎯⎯→ → → (7)


tAB AB − tCD CD + Ld⊥ = AC ,
input geometry, to maintain the topological con-
sistency of the model, are the same as on 2D: No su- ⎡ ⎯⎯⎯⎯→ ⎯⎯⎯→ → ⎤ ⎡ ⎯⎯⎯⎯→ ⎤
⎢ ABx CDx d⊥ x ⎥⎡ t ⎤ ⎢ ACx ⎥
perimposed elements are allowed and all intersections ⎢ ⎯⎯⎯⎯→ ⎯⎯⎯→ → ⎥⎢ AB ⎥ ⎢ ⎯⎯⎯⎯→ ⎥ (8)
⎢ AB y CDy d⊥ y ⎥⎢−tCD ⎥ = ⎢ ACy ⎥ .
must be identified. These geometry checks are made
⎢ ⎯⎯⎯⎯→ ⎯⎯⎯→ → ⎥⎣ L ⎦ ⎢ ⎯⎯⎯⎯→ ⎥
based on the shortest orthogonal distance between ⎣ ABz CDz d⊥ z ⎦ ⎣ ACz ⎦
two line segments in space.
Considering two segments AB and CD in arbitrary If the absolute value of the minimum orthogonal

directions, as shown in Figure 7, the normalized vector d⊥ distance, L, between two line segments is small enough,
orthogonal to these segments is given by Equation (4), considering a numerical tolerance, it is admitted that the
where × stands for the cross‐product between vectors. segments intersect at the point given by the parametric
The endpoints of the segment that gives the shortest or- coordinates. If the cross‐product of Equation (4) results in
thogonal distance between AB and CD are E and F , a null vector, it means that AB and CD are parallel. In
and the local parametric coordinates of AB and CD that this case, the segments are collinear if they share any
map these points are tAB and tCD , which are limited to common point.
[0,1]. Points E and F are then expressed as in Equation
(5), and the direction of segment EF is given by Equation
(6), where L is the value of the minimum orthogonal 4.3 | The ray method
distance between AB and CD :
Obtaining the coordinates of a mouse click on canvas is
⎯⎯⎯⎯→ ⎯⎯⎯→ necessary to insert new nodes/elements or select existing
→ AB × CD (4)
d⊥ = ⎯⎯⎯⎯→ ⎯⎯⎯→ , ones to check their information and results and edit their
‖ AB × CD ‖ properties. In a 2D canvas, it is quite trivial to determine

⎪E = A + t
⎯⎯⎯⎯→ the coordinates of the clicked point and check if an object
AB AB , (5)
⎨ ⎯⎯⎯→ has been selected by computing the distance between the

⎩ F = C + tCD CD , clicked position and any model component (in case of an
⎯⎯⎯→ → ⎯⎯⎯→ ⎯⎯⎯⎯→ (6) element, the orthogonal distance is computed with
EF = Ld⊥ = (C + tCD CD ) − (A + tAB AB ).
Equation 3).
C. LOPES ET AL. | 9

However, in a 3D canvas (MATLAB Axes widget that reason, to build the 3D frame and truss models, it is still
delimits a “plotting box”), determining the coordinates of necessary to enter the nodal coordinates via keyboard.
the clicked point is not straightforward, as the cursor Once the nodes are added, elements can be created by
moves on a plane screen and the depth of the clicked connecting the existing nodes with mouse clicks.
point is, a priori, undetermined. The strategy used on In the particular case of grillage models, all nodes and
LESM is to establish a ray casting direction, defined as elements are laid out in the same plane (global XY plane).
the line that goes from the camera viewpoint, where it Therefore, it is possible to build the model with mouse
enters the “plotting box,” to its projection on an opposite clicks from an oblique view by determining the co-
face of the 3D canvas, where it exits the box. Both points ordinates of the intersection between the ray direction
are provided by an attribute of the Axes widget, called and the global XY plane. The oblique view is more ap-
CurrentPoint. The shortest orthogonal distance between propriate for analyzing grillages, as the model is plane
the ray casting direction and the model components is but all loads and displacements are in the global
then calculated accordingly with the methodology de- Z‐direction, perpendicular to the model plane. Figure 9
scribed in the previous section. The first model compo- exemplifies the creation of a grillage model in ob-
nent intersected by the ray casting direction, if any, is lique view.
taken as the selected one, as illustrated in Figure 8. It The LESM program also allows grillage modeling in a
should be noted that the image has been slightly rotated 2D canvas, with an orthographic view of the model
so that it is possible to visualize the line used to define the pointing toward the global Z‐direction. In this case, some
ray. On a frontal view, from the user's perspective, it graphical representations of model components, such as
would not be possible to see the line, as it would be forces and supports, are different from conventional 2D
represented by a point. truss and frame models to indicate the out‐of‐plane pro-
This technique allows users to pick existing objects in jection. However, the geometric modeling is analogous to
a 3D canvas. However, it is not possible to insert nodes plane modeling and the subclass Emouse_2D is used to
with mouse clicks, as the depth of the click remains manage mouse interactions when dealing with grillage
unknown when it occurs in an empty region. For this models in a 2D perspective.

FIGURE 8 Model selection in a three‐dimensional canvas


10 | C. LOPES ET AL.

FIGURE 9 Creating a grillage model in oblique view

5 | EXAMPLES interactive capabilities of the program. Support condi-


tions were provided for nodes 1 (completely fixed) and 4
Four examples of models and analysis results obtained (displacement is fixed in the global Z‐direction, but ro-
with the graphical version of LESM are provided in this tations are free), through mouse clicks on such nodes,
section. The first one has its modeling process presented followed by quick changes of its properties with the Edit
with higher detailing to depict the advantages of using interactive panel, located on the main GUI. A con-
the interactive interface of the program to create struc- centrated load of 10 kN was applied to node 3 in an
tures. The second model presents the capabilities of the analogous fashion to the setting of supports and a uni-
program to handle and combine different load cases, form distributed load of −10 kN/m was applied to ele-
whereas the two following examples briefly show some of ment 1 by picking the element with a mouse click and
the capabilities of LESM to analyze 3D models. changing its load properties on the aforementioned Edit
In all examples, the elasticity and shear moduli of panel. It should be noted that these model parameters
elements material are 200 and 80 GPa, respectively; the (supports and loads) could also be set in the auxiliary
elements cross‐section area and moment of inertia (as- GUIs, instead of picking objects and using the Edit panel.
suming the same inertia value for torsion and bending The model and the results of deformed configuration,
about principal axes) are 104 mm2 and 108 mm4, respec- with a scale factor of 40, internal shear force diagram,
tively. These physical and geometrical properties of ele- and internal bending moment diagram are shown in
ments can be set and changed with ease in the LESM Figure 10.
program, through the Materials and Sections auxiliary It is clear by the example that modeling the structures
GUIs called by pressing the homonymous pushbuttons of linear elements is a straightforward task with LESM.
on the Modeling panel at the main GUI. Users may add The tools for providing all input data are made visible
new materials and cross‐sections, or change values of and accessible at all times on the main GUI of the ap-
existing properties, which are automatically updated for plication, granting an easy‐to‐grasp workflow that allows
all respective elements. users to focus their concerns on interpreting results and
The first example is the grillage model that was built evaluating the best model to represent a given physical
in the oblique view in the previous section. After defining problem, rather than on the modeling process itself.
geometry via mouse interactions on a 3D canvas, other In the LESM program, it is also possible to create
necessary model parameters were set using the multiple load patterns and combine them with specific
C. LOPES ET AL. | 11

FIGURE 10 (a) Grillage model. (b) Deformed configuration. (c) Shear force diagram. (d) Bending moment diagram

multiplication factors. To exemplify this functionality, represented by small spheres in 3D truss elements. This
the next model presents a 2D truss, where two different model was created by entering the nodal coordinates via
load cases were set, as well as a combination of those, keyboard and inserting the elements via mouse clicks on
with factors 1.2 for the first load case and 1.5 for the the created nodes. Although the mouse interaction is very
second. The two distinct load cases, their respective in- useful and intuitive for creating models, inserting all
ternal axial force diagrams, and reaction values at sup- nodes and elements with mouse clicks becomes a cum-
ports are shown in Figure 11. In addition, analogous bersome task when dealing with very large models. To
results are presented for the load combination. One can overcome this difficulty, new implementations for
notice that this is a valuable tool for the teaching of the managing large models will be considered in the future,
superposition principle for linear structural analysis. including templates, parameterization, or the coupling of
The third example is a 3D frame, previously shown in LESM with modeling tools, such as the “Truss Builder”
Figure 1 to present the main dialog window. Here, the [6], which should be a straightforward task, as LESM
results of a deformed configuration, with a scale factor of code is object‐oriented and open‐source.
200, and an internal bending moment diagram, relative to
the local y‐axis of each element, are displayed in
Figure 12. When a model has a large number of elements, 6 | E DU CA T I O NAL
such that diagrams become polluted, the LESM program METHODOLOGY
allows users to select one specific element to check its
internal force diagram. Furthermore, using mouse clicks, LESM has been effectively used at PUC‐Rio as an edu-
on 2D and 3D canvases, the program provides values of cational tool for basic structural analysis and computer
displacements and internal forces at any given point graphics courses. For the former, the software is very
within an element, as well as nodal displacement, at the useful for undergraduate students in Civil Engineering in
Information panel, located on the main GUI. the process of learning the basic methods of structural
For the last example, a 3D truss model of a trans- analysis (force method and displacement method).
mission tower is displayed in Figure 13, which shows the Through homework assignments, students simulate the
result of the deformed configuration with a scale factor of procedures that occur in the solution processes of these
300. The hinges (flexible joints between elements) are methods. The main benefit of this learning process is that
12 | C. LOPES ET AL.

F I G U R E 1 1 Two‐dimensional truss model: (a) Load case 1. (b) Internal axial forces for load case 1. (c) Load case 2. (d) Internal
axial forces for load case 2. (e) Internal axial forces for combination of load cases 1 and 2

students understand the physical meaning of the flex- of structural analysis. In addition, this methodology
ibility and stiffness coefficients that appear in the solu- motivates the student to learn the computational (cum-
tion processes. It has been observed that understanding bersome) aspects of the methods.
the physical meaning of these coefficients before learning These homework assignments are done in-
to calculate them really helps to understand the methods dividually. Undergraduate students use LESM to
C. LOPES ET AL. | 13

FIGURE 12 (a) Deformed configuration of three‐dimensional frame model. (b) Bending moment diagram

visualize the structure's response and calculate the To illustrate this educational methodology, Figure 14
numerical values of the required coefficients. As the shows a simulation of the solution of a simple frame by
program exports its main drawing area to the clip- the force method. These figures were extracted from one
board, the student can import the images in a word of the students' reports on the Structural Analysis course
processor and write the task report. at PUC‐Rio. The student made notes in these figures,
with the values calculated by LESM, using a text editor/
drawing tool.
Figure 14a shows the original structure, statically
indeterminate, with its loading. It is assumed a linear
elastic behavior, with no shear deformation (Euler‐
Bernoulli theory). Material elasticity modulus of all
structure members is E = 2 × 108 kN/m2. All members
have a unique cross‐section with area A = 0.005 m2 and
moment of inertia I = 0.0005 m4. The degree of static in-
determinacy of this structure is two. The support reac-
tions (X1 and X2) that were chosen as unknowns (called
redundants) of the solution by the force method are also
indicated.
Figure 14b shows the statically determinate auxiliary
structure (called primary structure) that was obtained
from the original structure, releasing the restrictions as-
sociated with the chosen redundants. This figure shows
the deformed configuration of the primary structure for
the applied external loading and indicates the loading
coefficients (δ10 and δ20), that is, the rotation and dis-
placement in the directions of the released restrictions
associated with the redundants. From the deformed
configuration of the primary structure, the student can
easily interpret the physical meaning of these
coefficients.
Figure 14c shows the effects of the first redundant on
the primary structure. The corresponding flexibility
coefficients (δ11 and δ21) are easily interpreted: They are
F I G U R E 1 3 (a) Three‐dimensional truss model. rotation and displacement in the directions of the re-
(b) Deformed configuration leased restrictions associated with the redundants due to
14 | C. LOPES ET AL.

FIGURE 14 Two‐dimensional frame model for simulating the force method

the first redundant with a unit value. Likewise, also helping teachers to propose more complete and
Figure 14d shows the flexibility coefficients (δ12 and δ22) elaborated classwork and homework.
for the second redundant. In addition, LESM has been used in introductory
At the end of the task, the student assembles a set of courses of computer graphics and software development
compatibility equations resulting from the force method for engineering students at PUC‐Rio. The high‐level
(δ10 + δ11X1 + δ12X2 = 0 and δ20 + δ21X1 + δ22X2 = 0) using MATLAB programming language and all its built‐in
the values of the coefficients calculated by LESM. To
demonstrate that this system of equations is really cor-
rect, the student checks whether the values of the reac-
tions chosen as redundants in the original structure really
solve the compatibility equations.
A similar homework is assigned to the students for a
simulation of the displacement method. Figure 15 illus-
trates the interpretation of some stiffness coefficients Kij
resulting from the solution process of this method. In this
example, the student imposes a unitary rotation on
a node.
The use of the LESM program in structural design
courses at PUC‐Rio has also been increasing lately. Its
multiple analysis features, combined with a user‐friendly
and interactive graphical interface, allow students to si-
mulate the behavior of one‐dimensional element models
(e.g., very common models in the design courses of me- F I G U R E 1 5 Deformed configuration due to the imposition
tallic and reinforced concrete structures) with ease, of an isolated unitary nodal rotation and the corresponding
helping them to deliver high‐quality assignments and stiffness coefficients in the solution by the displacement method
C. LOPES ET AL. | 15

functions and sophisticated graphics resources, combined same course. For example, in the second semester of 2019,
with an easy‐to‐use environment for developing GUIs, two final projects, developed by teams of three under-
provide the ideal mechanisms for presenting concepts on graduate and/or graduate students, extended LESM to
how to create a graphical interactive program for stu- consider 2D‐ and 3D‐inclined supports and linear‐elastic
dents who are not very familiar with computer science rotational semirigid connections at one or two ends of an
topics. For example, in a previous article [31], the authors element. For these projects, students needed to modify
have described an education methodology in which the both the analysis solver and the interface of the program.
complete structure of the classes of the analysis solver of
LESM is provided, but the contents of the methods are
not presented completely, so that the students could fill 7 | ACA DEM IC PE RFORMANC E
in the gaps, as individual works. In that article, this ASSESSMENT
strategy was exemplified for the implementation of a
computational procedure for structural analysis. In this To assess the results of the educational methodologies
article, it is intended to explore students' understanding described in the previous section, a survey was done with
of handling graphical interface events associated with the students of the last edition of the courses “Structural
modeling a structure using the mouse. To illustrate this Analysis” and “Fundamentals of Applied Computer
methodology in the graduate course of fundamentals of Graphics” of the Department of Civil Engineering of
applied computer graphics of the Civil Engineering De- PUC‐Rio, in the second semester of 2019 and in the
partment of PUC‐Rio, which is also taken by senior un- (online) first semester of 2020, in which LESM was pre-
dergraduate students, the incomplete source code of the sented in different contexts, as explained in the previous
class MyCanvas_2D of a test application4 of the afore- section. The first is an obligatory course attended by
mentioned Emouse class is shown in Appendix B. undergraduate students (22 in the surveyed class) and the
The objective of class MyCanvas_2D, which is a sub- second is an elective course attended by advanced un-
class of class Canvas_2D mentioned previously, is to dergraduate and graduate students (19 in the surveyed
handle typical mouse events in an interactive graphics class). In the undergraduate course, individual home-
application. The three public methods of class My- work assignments that made use of the LESM program,
Canvas_2D correspond to callback functions that respond like the exercises described in the previous section and
to user mouse actions. These methods track mouse po- shown in Figures 14 and 15, represent 15% of the total
sitions on canvas for button‐pressed, mouse‐motion, or grade. However, in the graduate course, programming
button‐released events. Learning how to handle these assignments (also individual), extending the source code
events is very important in any interactive graphics ap- of the LESM program (both in terms of numerical ana-
plication that involves an active graphic interface that lysis and in the development of the graphical interface),
responds to mouse events. The code shown is just an represent the entire evaluation. Although the same sur-
example and several other parts of the program code have vey was applied to the undergraduate and graduate
to be complemented. courses, some questions do not apply to students in both
This learning methodology is interesting because the disciplines. For this reason, the number of respondents
student learns to program by studying a complete pro- varies according to the question. This survey was based
gram that has already been tested and has an organized on the one suggested by Bishay [5] and it was anonymous
structure. The advantage of this methodology is that the and ungraded as informed to the students. When ap-
student does not start from a blank page, which is a very plicable, students were asked to evaluate their learning
difficult task for those who have no programming ex- benefits on the items listed below (A–O) using a scale of
perience. Nevertheless, the student is forced to under- 1–5 (where 1 means “very low learning,” 2 means “little
stand the structure of the provided program to fill in the learning,” 3 means “medium learning,” 4 means “very
gaps. Considering that the program executable is made good learning,” and 5 means “excellent learning”).
available to students, they are sure that what is developed Table 1 shows the statistics of the research results.
is feasible, in addition to understanding the overall be-
havior of the program. A. Translation of a real problem in a computer code or
In addition, integrated projects involving the knowl- in a graphics application.
edge of structural analysis concepts and the improvement B. Program development in MATLAB.
of the LESM interface were assigned to the students of the C. Development of interactive graphics program (GUI).
D. Design of a friendly and robust graphic interface.
4
See mouse_events_app in www.gitlab.com/cortezpedro/canvas or in E. Development of several versions to improve your
www.mathworks.com/matlabcentral/fileexchange/76872-canvas-tool project.
16 | C. LOPES ET AL.

TABLE 1 Statistics of the students' responses to the O. How was the overall experience in the discipline?
assessment survey questions

Item No. of respondents Mean Max Min Variance The survey was designed as a feedback metric on the
use of the LESM program in the context of the courses, so
A 41 4.56 5 3 0.402
there is a strong relationship between the results pre-
B 19 4.68 5 4 0.228 sented and the object of study of the article, thus attesting
C 19 4.68 5 3 0.339 to the survey's internal validity. A possible threat to this
validity would be a bias of the students, who want to
D 19 4.26 5 3 0.316
avoid bad evaluations, but it is not a high risk, as the
E 41 4.15 5 2 0.578 research was anonymous.
F 41 4.37 5 3 0.638 As both groups of students are reasonably similar,
G 41 4.80 5 3 0.211 civil engineering students with little programming ex-
perience, the results may not be representative in other
H 22 4.14 5 3 0.504
scopes. But for the present survey purposes, this is not a
I 22 4.59 5 4 0.253 problem, as this is the context in which it is intended to
J 22 4.45 5 3 0.545 use LESM as an educational tool.
K 41 4.80 5 4 0.161
There are quite a few methods in the literature to
interpret the 5‐point Likert scale and to obtain statistical
L 41 4.59 5 3 0.349
results. This study adopts the traditional way. The aver-
M 19 4.63 5 3 0.357 age is an indicator of how the groups think about a given
N 41 4.54 5 3 0.305 issue, but it may not be representative in case the var-
iance is high. Therefore, the idea of the article is to pre-
O 41 4.83 5 4 0.145
sent simple results, which give indications of how groups
see the use of the LESM program and whether there is an
F. Obtaining suggestions from others (teacher and agreement between individuals (the lower the variance,
colleagues) to improve your project. the better). The minimum and maximum metrics are
G. Review of some content and concepts of engineering complementary data.
and programming. From the students' responses to the survey, it is clear
H. Understanding the methodology of the force and that the adopted educational methodology is very pro-
displacement methods of structural analysis through mising. The results shown in Table 1 illustrate broadly
homework assignments using LESM. satisfactory feedback, but some specific points stand out.
I. Usage of LESM program to deliver high‐quality One can notice that questions E and H, though well‐
assignments. evaluated, received a bit poorer response than others. The
J. Usage of LESM program to help lecturer to propose former is related to versioning of projects, which is an
more complete and elaborated classwork and important part of software development that engineering
homework. students may not be so familiarized with. In this regard,
K. One of the objectives of the course is “to motivate it is intended to present version control tools, such as Git
and engage the student to acquire knowledge that [8] and SVN [28], to future students of the computer
will be used in the future.” How do you rate the graphics course. The latter is about better understanding
discipline on this aspect? topics approached in the structural analysis course
L. One of the objectives of the course is "to motivate through homework assignments involving LESM, so this
and engage the student to become innovative, de- is an indication that there is room for improvement on
velop their graphic applications and project the be- that, such as assigning the same homework on con-
havior of their applications." How do you rate the secutive weeks but with different models and increasing
discipline on this aspect? the difficulty level. However, the two questions with the
M. One of the objectives of the course is “to motivate most positive responses are K and O, pointing out that
and engage the student to make the programming students felt motivated and confident that they were
task enjoyable and fun.” How do you rate the dis- learning skills that will be useful in the future and that
cipline on this aspect? the overall experience in the course they took was good.
N. One of the objectives of the course is “to motivate the These are the first indicatives that the advent of LESM
student to advance his knowledge in the field of to heighten students' interest in the referred courses will
structural mechanics.” How do you evaluate the be a fruitful endeavor in terms of motivation and per-
discipline on this aspect? formance. The “Fundamentals of Applied Computer
C. LOPES ET AL. | 17

Graphics” course has undergone a major reformulation The new graphical version of the LESM program
to include MATLAB as a programming language and the complements the first non‐graphic version of the
LESM program as a working environment. It is inter- program [31], without losing the focus on the educa-
esting to mention that although this course is offered by tional approach, which is the main purpose of the
the Graduate Program and is an optional subject for project. This is verified by the use of the program in
undergraduate students, the number of undergraduate some undergraduate and graduate courses at PUC‐
students enrolling in this course has increased sig- Rio. Since the release of the new version, the program
nificantly since the reformulation of the course began. has been used in several ways for teaching structural
The “Structural Analysis” course already made use of analysis theory, computational implementation of
another interactive graphics tool for modeling and ana- structural analysis methods, and basic concepts of
lyzing structures, Ftool [22], that is limited to 2D frame software development and computer graphics for en-
models. However, LESM allows analysis of 3D models, gineering students.
helping students visualize the spatial behavior of struc- The authors also expect that providing a GUI that
tures, especially for grillage models. Moreover, LESM is includes all phases of the analysis, from modeling to
an open‐source program. The inclusion of LESM in this postprocessing, the program will facilitate the work of
specific course serves the purpose of exposing students to students and also engineers, by reducing the time re-
how structural analysis software is made, providing ac- quired for modeling and interpreting the results and,
cess to a well‐structured and fully documented program. consequently, improving productivity. In fact, with
The authors believe that this is a valuable addition to commercial FEA packages, users can do everything that
motivate undergraduate students to make use of pro- can be done in LESM and much more, however, not so
gramming in their future work as engineers. This notion easily. Those packages have innumerable options for
is strengthened by the positive feedback obtained on several models and analysis types that make their inter-
questions B, C, G, K, L, M, N, and O in the survey pre- face and usability challenging sometimes. On the other
sented above. hand, LESM deals only with one‐dimensional elements,
which are used for simulating many structural problems,
with an interface that was designed to be simple and
8 | CONCLUSIONS intuitive, counting on high modeling capabilities.
Some implementations that are underway for future
The development of this study has shown that it is versions of the program include new types of analysis,
possible to create a graphical program in MATLAB that such as dynamic and nonlinear, with the possibility to
has advanced resources for modeling structures, with plot graphs of the time/frequency response of the struc-
relative ease when compared with other programming ture and its equilibrium path. In addition, it is expected
languages and environments. Creating a GUI, managing that the program will also be able to execute steel
mouse actions on a canvas, manipulating the visuali- structure design, according to the technical standards of
zation of 3D models, and modeling topologically con- different regions.
sistent structures are not trivial tasks, but the
sophisticated plotting functions, graphic resources, and ACKN OWLEDGMENTS
high‐level programming language of MATLAB made it The authors would like to thank the Technical‐Scientific
possible to deal with these topics in a simple way. To Software Development Institute of PUC‐Rio (Tecgraf/
accomplish these tasks, auxiliary OOP classes (Canvas PUC‐Rio) for the space and resources provided during
and Emouse) were created to assist the management of the development of this study. It was financed in part by
the Axes widget and the mouse events, and simple the Coordenação de Aperfeiçoamento de Pessoal de Nível
computational geometry strategies were adopted to deal Superior—Brasil (CAPES)—Finance Code 001.
with some modeling issues.
The price to be paid is that MATLAB is an interpreted AUTHOR CONT RIBUTIONS
language that lacks efficiency. Therefore, it is important Investigation, formal analysis, software implementation,
to optimize the code to fully explore the advantages of writing (original draft), and writing (review and editing):
this high‐level programming language with effectiveness, Pedro C. Lopes. Methodology, conceptualization, formal
especially when it comes to graphical functions. For analysis, software implementation, writing (original draft),
example, it was observed that MATLAB works much and writing (review and editing): Rafael L. Rangel.
better when using matrix operations than iteration loops Supervision, educational methodology, data curation, and
to perform multiplications of a great amount of data. writing (review and editing): Luiz F. Martha.
18 | C. LOPES ET AL.

DATA AVAILABILITY STATEMENT 11. M. de Berg, M. van Kreveld, M. Overmars, and O. Schwarzkopf,
The data that support the findings of this study are openly Computational geometry: algorithms and applications, 3rd ed.,
available on the internet site of LESM—Linear Elements Springer, 2008.
12. C. Depcik and D. Assanis, Graphical user interfaces in an en-
Structure Model—at www.tecgraf.puc-rio.br/lesm. There are
gineering educational environment, Comput. Appl. Eng. Educ.
three options for downloading the program:
13 (2005), 48–59.
13. S. L. Devadoss, and J. O'Rourke, Discrete and computational
• INSTALLER: Complete installation with MATLAB geometry, Princeton Univ. Press, Princeton, NJ, 2011.
runtime library, indicated for those who have not in- 14. FEATool Multiphysics, available at https://www.featool.com/
stalled MATLAB: https://www.tecgraf.puc-rio.br/ftp_ 15. W. O. Galitz, The essential guide to user interface design: an
pub/lfm/LESM_v2_0_1_Installer.exe introduction to GUI design principles and techniques, 2nd ed.,
• SOURCE CODE: Source code to run the program in John Wiley & Sons, Hoboken, NJ, 2002.
16. C. M. Hoffmann, Geometric and solid modeling: an introduc-
the MATLAB environment: https://www.tecgraf.puc-
tion, Morgan Kaufmann Publ., Burlington, MA, 1989.
rio.br/ftp_pub/lfm/LESM_v2_0_1_source_code.zip
17. J. F. Hughes, A. van Dam, M. McGuire, D. F. Sklar, J. D. Foley,
• MATLAB APP: Packaged application to be installed in S. K. Feiner, and K. Akeley, Computer graphics: principles and
the MATLAB environment: https://www.mathworks. practice, 3rd ed., Addison‐Wesley Professional, Boston, MA, 2013.
com/matlabcentral/fileexchange/69801-lesm-linear- 18. C. S. Lent, Learning to program with MATLAB: building GUI
elements-structure-model tools, John Wiley & Sons, Hoboken, NJ, 2013.
19. C. S. Lent, J. Brockman, V. Goodrich, and K. Meyers, Teaching
ORCID MATLAB in first‐year engineering: a GUI tool directed approach.
4th First‐Year Eng. Exp. (FYEE) Conf., Pittsburgh, PA, 2012.
Luiz F. Martha http://orcid.org/0000-0002-5783-5151
http://fyee.asee.org/FYEE2012/papers/1010.pdf
20. M. Mantyla, An introduction to solid modeling, W H Freeman &
REFERENCES Co., New York, NY, 1988.
1. E. Abad, M. García, R. Blázquez, C. Castejon, and J. García‐ 21. S. Marschner, and P. Shirley, Fundamentals of computer gra-
Prada, Effects of an android app on mechanical engineering phics, 4th ed., A K Peters/CRC Press, Boca Raton, FL, 2015.
students, Comput. Appl. Eng. Educ. 26 (2018), 1050–1057. 22. L. F. Martha, Ftool‐Two‐dimensional Frame Analysis Tool,
https://doi.org/10.1002/cae.21955 available at http://www.ftool.com.br
2. U. D. Ahmad, Development of a structural analysis program 23. L. F. Martha, Análise matricial de estruturas com orientação a
(SABSM) using MATLAB featuring graphical user interface. objetos (Matrix structural analysis with object orientation),
MSc Thesis, City Univ. London, 2013. GEN LTC, Rio de Janeiro, Brazil, 2018.
3. A. Andreatos and A. Zagorianos, Matlab GUI Application for 24. MASTAN2, available at http://www.mastan2.com
Teaching Control Systems. EDUCATION'09: Proceedings of the 25. W. McGuire, R. H. Gallagher, and R. D. Ziemian, Matrix
6th WSEAS Internat. Conf. Engineering Educ. (P. Dondon, O. structural analysis, John Wiley & Sons, New York, 2000.
I. Martin, A. Zaharim, V. Mladenov, Z. Bojkovic, and D. Boj- 26. E. N. McKay, UI is communication: how to design intuitive, user‐
kovic, eds.), Rhodes, Greece, 2009, pp. 208–211. centered interfaces by focusing on effective communication,
4. F. F. Bernardon, C. A. Pagot, J. L. D. Comba, and C. T. Silva, GPU‐ Morgan Kaufmann, Burlington, MA, 2013.
based tiled ray casting using depth peeling, J. Graph. Tools 11 (2006), 27. J. O'Rourke, Computational geometry in C, 2nd ed., Cambridge
no. 4, 1–16. https://doi.org/10.1080/2151237X.2006.10129227 University Press, Cambridge, UK, 1998.
5. P. L. Bishay, “FEApps”: Boosting students' enthusiasm for coding 28. C. M. Pilato, B. Collins‐Sussman, and B. W. Fitzpatrick, Version
and app designing, with a deeper learning experience in en- control with subversion, 2nd ed., O'Reilly Media, Sebastopol,
gineering fundamentals, Comput. Appl. Eng. Educ. 24 (2016), CA, 2008.
no. 3, 456–463. https://doi.org/10.1002/cae.21723 29. F. P. Preparata, and M. I. Shamos, Computational geometry: an
6. P. L. Bishay, Teaching the finite element method fundamentals introduction, Springer, New York, NY, 1985.
to undergraduate students through truss builder and truss ana- 30. Qt Documentation (https://doc.qt.io/).
lyzer computational tools and student‐generated assignments 31. R. L. Rangel and L. F. Martha, LESM—An object‐oriented
mini‐projects, Comput. Appl. Eng. Educ. 28 (2020), no. 4, MATLAB program for structural analysis of linear element
1007–1027. https://doi.org/10.1002/cae.22281 models, Comput. Appl. Eng. Educ. 27 (2019), no. 3, 553–571.
7. J. Canny, The future of human‐computer interaction, ACM Queue https://doi.org/10.1002/cae.22097
4 (2006), no. 6, 24–32. https://doi.org/10.1145/1147518.1147530 32. D. F. Rogers, Procedural elements for computer graphics,
8. S. Chacon, and B. Straub, Pro Git, 2nd ed., Apress, New York, McGraw‐Hill Int. Ed., Comp. Ser., 1985.
NY, 2014. 33. D. F. Rogers, and J. A. Adams, Mathematical elements for
9. A. Cooper, R. Reimann, D. Cronin, and C. Noessel, About face: computer graphics, 2nd ed., McGraw‐Hill Int. Ed., Comp.
the essentials of interaction design, 4th ed., John Wiley & Sons, Ser., 1990.
Hoboken, NJ, 2014. 34. M. V. B. Santana and R. A. M. Silveira, Sistema computacional
10. B. Cox, and A. Novobilski, Object‐oriented programming: an gráfico interativo para problemas de instabilidade em pórticos planos
evolutionary approach, Addison‐Wesley, Upper Saddle River, (Interactive graphic computer system for instability problems in
NJ, 1991. plane frames). XXXV CILAMCE—35th Iberian Latin‐Am. Congr.
C. LOPES ET AL. | 19

Computational Methods Eng. (E. Parente Jr., ed.), Fortaleza, CE,


transfer over granular materials using particle‐based
Brazil, 2014.
35. S. R. Subramanya and A. Farahani, Point‐of‐view article on: Design methods. He received his BSc and MSc degrees in
of a Smartphone App for Learning Concepts in Mathematics and Civil Engineering, with emphasis on computational
Engineering, Int. J. Innov. Sc. 4 (2012), no. 3, 173–183. solid mechanics, from the Pontifical Catholic Uni-
36. J. Tidwel, Designing interfaces: patterns for effective interaction versity of Rio de Janeiro (PUC‐Rio), Brazil, where he
design, 2nd ed., O'Reilly Media, 2011. developed some works on nonlinear analysis of frame
37. E. D. Torres and L. F. Martha, Development of a class in the structures.
context of OOP for generic management of mouse events in a
canvas in the MATLAB environment. XXXVIII CILAMCE—
Luiz F. Martha is an Associate Profes-
38th Iberian Latin‐Am. Congr. Computational Methods Eng.
(P. O. Faria, R. H. Lopez, L. F. F. Miguel, W. J. S. Gomes, and sor in Civil Engineering at Pontifical
M. Noronha, eds.), Florianópolis, SC, Brazil, 2017, p. 20. https:// Catholic University of Rio de Janeiro
web.tecgraf.puc‐rio.br/~lfm/papers/Torres‐Martha‐CILAMCE2017‐ (PUC‐Rio), Brazil, and member of the
0642_078082.PDF Tecgraf Institute of Technical‐Scientific
Software Development of PUC‐Rio (Tecgraf/PUC‐
Rio). He received his PhD degree in Structural
AUTHOR BIOGRAPHIES
Engineering in 1989 from Cornell University, working
in the Cornell Fracture Group and in the Cornell
Pedro C. Lopes is an MSc student in the Program of Computer Graphics. His research interests
Institute of Computing at the Flumi- include Structural Analysis, Computational Me-
nense Federal University (UFF). He has chanics, Educational Software, Mesh Generation,
a BSc degree in Civil Engineering from Geometric Modeling, and Computer Graphics. He is
UFF (2019). He was an intern in the the author of two textbooks related to structural
Tecgraf Institute at PUC‐Rio (2018–2019), where he analysis and has published several articles in con-
worked on and became a co‐author of the LESM gresses and peer review journals.
program. His research interests include HPC applied
to numerical methods, computer graphics, computa-
tional solid modeling, and continuum mechanics.
How to cite this article: P. C. Lopes, R. L. Rangel,
Rafael L. Rangel is a PhD student at and L. F. Martha, An interactive user interface for a
the Polytechnic University of Catalonia structural analysis software using computer
(UPC), working in the International graphics techniques in MATLAB, Comput. Appl.
Center for Numerical Methods in En- Eng. Educ. (2021), 1–21.
gineering (CIMNE), Spain. The focus of https://doi.org/10.1002/cae.22406
his research is on the simulation of fluid flow and heat
20 | C. LOPES ET AL.

APPENDIX A

MATLAB function to check the relative position between two elements


C. LOPES ET AL. | 21

APPENDIX B

Example of template source code to be completed by students

You might also like