13
ORIGINAL ARTICLE An object-oriented approach for mechanical components design and visualization Mihai Dupac Received: 29 June 2010 / Accepted: 5 April 2011 / Published online: 23 April 2011 Ó Springer-Verlag London Limited 2011 Abstract In this paper, development of shape modeling tools for engineering design, analysis, simulation, and visualization is presented. The approach based on the idea of function-based shape modeling is combined with the power and versatility of the object-oriented programming (OOP). An OOP code, initially developed as a teaching and learning tool for educational use in an undergraduate Modeling and Simulation course, to generate mechanism components is presented. Different parametric, explicit, and implicit functions or their combination are used to generate mechanical components shapes. Using a blending process, sophisticated shapes have been generated on the graphical interface. However, the ideas and concept of the OOP mechanical components design presented in this paper can be applied to other application areas. Keywords Design Shape modeling OOP Visualization 1 Introduction Computational methods for the design, analysis, and visualization of 3D mechanical components shapes have become indispensable tools in engineering practice. The importance of shape modeling in computer aided design (CAD) or virtual prototyping has been recognized for a long time. The idea of function-based approach to shape modeling is that complex geometric shapes can be pro- duced from a ‘‘small formula’’ rather than thousands of polygons. Parametric, implicit or explicit functions and their combinations are used to define the shapes. Object-oriented (OO) methods have now been imple- mented in numerous engineering applications. A Web-based application for the design and analysis of mechanisms was developed by Cheng and Trang [8]. The toolkit uses a collection of OOP classes to handle mechanisms ranging from the simple to very complex linkages. Cojocaru and Karlsson [9] presented an OO modeling frame for simu- lating crack propagation in a linkage mechanism, by a generalized node release technique. An intelligent software system, developed on the OOP basis, which can support machine tool design was described by Woonga et al. [47]. Santos [38] discuss the design and implementation of an OO database view mechanism, which allows the redefinition of the structure and the behavior of the stored objects. Qiao [37] presents an OOP approach for the boundary element method in 2D heat transfer analysis. Advantages of the OOP are demonstrated for two different types of partial differential equations. Kromera et al. [24] describe a design implementation of a FEM multibody flexible mechanisms code using object-oriented architecture. An OOP class systems for finite element modeling and analysis was suggested by Mackie [30]. Pantale et al. [33] present an OO implementation, using the C?? language, of an explicit finite element method (FEM) related to metal forming and impact simulations. Larson and Cheng [25] developed a Web-based inter- active design package. The Web-based system was implemented through a client/server model (applet and CGI-based). Su et al. [42] developed an extensible Java applet architecture applied to a computer-aided-design M. Dupac (&) School of Design, Engineering and Computing, Bournemouth University, Talbot Campus, Fern Barrow, Poole, Dorset BH12 5BB, UK e-mail: [email protected] 123 Engineering with Computers (2012) 28:95–107 DOI 10.1007/s00366-011-0220-3

An object-oriented approach for mechanical components design and visualization

Embed Size (px)

Citation preview

Page 1: An object-oriented approach for mechanical components design and visualization

ORIGINAL ARTICLE

An object-oriented approach for mechanical componentsdesign and visualization

Mihai Dupac

Received: 29 June 2010 / Accepted: 5 April 2011 / Published online: 23 April 2011

� Springer-Verlag London Limited 2011

Abstract In this paper, development of shape modeling

tools for engineering design, analysis, simulation, and

visualization is presented. The approach based on the idea

of function-based shape modeling is combined with the

power and versatility of the object-oriented programming

(OOP). An OOP code, initially developed as a teaching and

learning tool for educational use in an undergraduate

Modeling and Simulation course, to generate mechanism

components is presented. Different parametric, explicit,

and implicit functions or their combination are used to

generate mechanical components shapes. Using a blending

process, sophisticated shapes have been generated on the

graphical interface. However, the ideas and concept of the

OOP mechanical components design presented in this

paper can be applied to other application areas.

Keywords Design � Shape modeling �OOP � Visualization

1 Introduction

Computational methods for the design, analysis, and

visualization of 3D mechanical components shapes have

become indispensable tools in engineering practice. The

importance of shape modeling in computer aided design

(CAD) or virtual prototyping has been recognized for a

long time. The idea of function-based approach to shape

modeling is that complex geometric shapes can be pro-

duced from a ‘‘small formula’’ rather than thousands of

polygons. Parametric, implicit or explicit functions and

their combinations are used to define the shapes.

Object-oriented (OO) methods have now been imple-

mented in numerous engineering applications. A Web-based

application for the design and analysis of mechanisms was

developed by Cheng and Trang [8]. The toolkit uses a

collection of OOP classes to handle mechanisms ranging

from the simple to very complex linkages. Cojocaru and

Karlsson [9] presented an OO modeling frame for simu-

lating crack propagation in a linkage mechanism, by a

generalized node release technique. An intelligent software

system, developed on the OOP basis, which can support

machine tool design was described by Woonga et al. [47].

Santos [38] discuss the design and implementation of

an OO database view mechanism, which allows the

redefinition of the structure and the behavior of the stored

objects.

Qiao [37] presents an OOP approach for the boundary

element method in 2D heat transfer analysis. Advantages of

the OOP are demonstrated for two different types of partial

differential equations. Kromera et al. [24] describe a design

implementation of a FEM multibody flexible mechanisms

code using object-oriented architecture. An OOP class

systems for finite element modeling and analysis was

suggested by Mackie [30]. Pantale et al. [33] present an OO

implementation, using the C?? language, of an explicit

finite element method (FEM) related to metal forming and

impact simulations.

Larson and Cheng [25] developed a Web-based inter-

active design package. The Web-based system was

implemented through a client/server model (applet and

CGI-based). Su et al. [42] developed an extensible Java

applet architecture applied to a computer-aided-design

M. Dupac (&)

School of Design, Engineering and Computing,

Bournemouth University, Talbot Campus,

Fern Barrow, Poole, Dorset BH12 5BB, UK

e-mail: [email protected]

123

Engineering with Computers (2012) 28:95–107

DOI 10.1007/s00366-011-0220-3

Page 2: An object-oriented approach for mechanical components design and visualization

system of several spatial linkages. A new Java approach to

computer-aided spatial linkage design was presented by

Collins et al. [10].

Web and OOP approaches give students an alternative

way to engage in learning and to have learning control in

terms of place, pace, and time. In this respect, the incor-

poration of an interactive visualization is the key in

engaging students in the exploration and discovery of

knowledge. Siemers and Fritzson [41] presented an inte-

grated visualization and simulation tool for multibody sys-

tems with detailed contact analysis. Seth et al. [40]

developed a portable VR interface (SHARP) for mechanical

assembly. The SHARP system is simulating realistic part-to-

part and hand-to-part interactions in virtual environments.

Bloomenthal [2, 3] discuss a numerical technique that

approximates an implicit surface with a polygonal repre-

sentation. Parametric with parametric, and parametric with

implicit surfaces intersection was studied by de Figueiredo

[11] using a domain decomposition method. A technique

for merging objects modeled with subdivision surfaces was

proposed by Hui and Lai [23]. A blend curve was used for

connecting the given surfaces. Parametric representations

of shapes have been discussed in [31] and are very

appropriate selections when handling complex shapes in

three dimensions.

The idea of the hybrid function-based approach and

interactive function-based shape modeling [27, 28] is to use

different mathematical functions to modeling shapes, by

defining objects by analytical formulas and by imple-

menting mathematical operators for geometry modifica-

tions. A relatively similar approach for shape modeling

applied to mechanical components generation and visual-

ization was discussed in [12] and a Web-based approach in

[13, 35]. Cartwright et al. [6] describe experiments for

designing and developing a geometrical modeler combin-

ing ideas from empirical modeling and from implicit sur-

face modeling. Another approach for shape modeling was

proposed in [16], where a system implementation for

modeling shapes using real distance functions have been

used.

In this paper, the design and implementation of a object-

oriented software for mechanism components modeling

and visualization is described. An OOP code to specifying

objects shapes is developed. The convenience and sim-

plicity of the software is illustrated through application

examples. Different implicit, explicit, and parametric

functions (or their combinations) have been used for the

modeling of the mechanical components shapes. Further-

more, different representations of surfaces such as gears,

springs, chains, rivets, and ball bearings have been gener-

ated and visualized.

Those representations aim at improving the under-

standing of engineering design through shape modeling

interactive simulation. The developing of this educational

tool has derived from the engineers’ continuing need to

understand and apply mathematical models in the design

of complex mechanical components and systems [5, 29].

The presented ideas and concepts demonstrate advanta-

ges of using this software in classroom instruction, pro-

viding valuable visualization tools to engineering

students. The examples provide students with an excel-

lent understanding of complex mechanical systems by

using graphical visualization. The considerations and

discussions in this paper may be also useful for the

advancement of computer-aided instructional tools in

other subject areas.

2 Object-oriented analysis and design strategy

2.1 Object-oriented programming process

An object-oriented approach process is an analysis and

design strategy for software development that includes

• an object-oriented analysis (OOA) phase (identifies

system requirements and specifications),

• an object-oriented design (OOD) phase (defines system

operations and modules interaction), and

• an object-oriented programming (OOP) phase (realiza-

tion of the software design).

The OOP can be regarded as a modeling approach to

software construction and development. In OOP, a soft-

ware program is regarded as a physical model, simulating

either a real or imaginary part of the world. The software,

usually structured in terms of concepts familiar to the

human, should be easier to create, understand, and

maintain.

In OOP, key concepts are modeled as user-defined

classes and are seen as the association between the data

structures and the methods that manipulate the data. More

importantly, the data structures and the manipulating

functions are regarded as ‘‘objects’’.

The classes are organized hierarchically; a new class

is defined based on an existing class by using the

inheritance mechanism. The main advantage of inheri-

tance is that the algorithms are still valid for a new

defined class (resulting in a more reusable code). An

example of a hierarchically organized Polygon class,

used in the blending process, can be visualized in

Fig. 1.

The hierarchy resulting from the repeated application of

inheritance is called the inheritance hierarchy. The new

class inherits the variables and methods of the existing

class. It may add new variables and methods of its own and

may redefine inherited methods.

96 Engineering with Computers (2012) 28:95–107

123

Page 3: An object-oriented approach for mechanical components design and visualization

Conceptual modeling in OOP requires that

• Key concepts in the problem domain are organized in

an inheritance hierarchy.

• Subclasses in the inheritance hierarchy must semanti-

cally conform to superclasses.

• Objects of a subclass can substitute objects of a

superclass.

A class module is an ‘‘idea’’ that provides a template for

the attributes and the services that the object will provide.

Template classes are generic ones, for example generic

lists of any kind of object (nodes, elements, integration

points, etc.). Templates are the fundamental enabling

technology that supports construction of maintainable

highly abstract, high performance scientific codes in C??.

2.2 Object-oriented approach for shape design

For the design of the mechanism components, an OOP

approach has been considered. A C?? code was used for

the representation of the 3D graphical shapes of the created

objects. The OOP objects are defined using implicit,

explicit or parametric functions, or their combinations.

The objects used in the main C?? program and defined

on the graphic interface allow the user to rotate, scale, and

translate the associated shapes (mechanism components)

on screen. In order to create a more complex mechanical

component shape, a blending process in which two or more

shapes are combined is used. The blending process, which

allows a great degree of interactivity, is described in detail

in the next section. The point of departure in developing

the process was the creation of a basic class library. In the

process, the shapes viewed as objects are stored in prede-

fined object classes.

The predefined classes are based on the classical OOP

and use the ‘‘inheritance’’ and ‘‘part off’’ concepts in the

process. The ‘‘inheritance’’ concept allows a new created

object to take over (or inherit) attributes and behavior of

the pre-existing classes. The ‘‘part off’’ concept create a

new object using parts of the pre-existing classes. The

objects not yet included on a pre-existing classes are stored

in new classes and referred as pickable objects. The main

application is used for processing and rendering of the

shapes.

3 The shape generation process

In the graphical user interface, i.e., the Shape3D class, 3D

shapes (3D OOP objects) are generated using implicit,

explicit, or parametric functions, or their combination.

Defining shapes using mathematical functions is the most

straightforward method of function-based shape modeling.

Some shapes can easily be defined with implicit and

explicit formulas, while others can be defined better by

using a parametric representation. Shapes properties

such as color, texture, position, rotation, etc. can be also

specified.

3.1 Implicit shapes

Implicit surfaces are well suited for simulating physically

based deformations [43].

The implicitly defined objects are objects described by

an implicit surface. An implicit surface is mathematically

defined [3] as the iso-surface of a field function, i.e.,

S = {p = (x, y, z): F(x, y, z) = iso} where iso 2 R is a

constant value. For the most common case, a implicit

surface is defined as a continuous scalar-valued function

F over the domain R3; i.e., locus of points at which the

function takes the zero value F = F(x, y, z) = 0 and where

x, y, z, are Cartesian coordinates.

The most studied form of implicit surfaces are algebraic

surfaces. Algebraic surfaces use polynomial functions

(typically low degree polynomials) for describing surfaces,

i.e. F = F(x, y, z) is a polynomial in x, y, and z. The most

popular algebraic surfaces are the quadratic implicit

(degree 2) surfaces, often referred to as quadrics. A qua-

dratic implicit surface is described by

Fðx; y; zÞ ¼ Ax2 þ By2 þ Cz2 þ 2Dxyþ 2Exzþ 2Fyz

þ 2Gxþ 2Hyþ 2Jzþ K ¼ 0; ð1Þ

Polygon

Parallelogram

Rhombus

+ computeValues( ): void+ checkValues( ): void

# side: Real

+ area( ): Real+ scaleSide(factor: Integer): Void

Square# side: Real

# angle: Integer

# side1: Real# side2: Real# angle: Integer

+ area( ): Real

Fig. 1 An example of a hierarchically organized Polygon class

Engineering with Computers (2012) 28:95–107 97

123

Page 4: An object-oriented approach for mechanical components design and visualization

which is a polynomial of degree 2. Equation (1) can be

rewritten in a matrix notation as

½x y z 1�

A D E GD B F HE F C JG H J K

2664

3775

xyz1

2664

3775 ¼ 0: ð2Þ

The surface shape depends upon the algebraic properties of

the symmetric matrix defined in Eq. (2). Some quadratic

surfaces produced by varying the coefficients of Eq. (2)

are: ellipsoid or sphere, cone, cylinder, hyperboloid, and

paraboloid. The first four shapes, ellipsoid, sphere, cone,

and cylinder, are shown in Fig. 2. A sphere with radius

r can be defined by a second-degree algebraic implicit

equation as F(x, y, z) = x2 ? y2 ? z2 - r2, a conical

shape can be defined by Fðx; y; zÞ ¼ ðx2 þ y2Þ cos2 hþz2 sin2 h; and an ellipsoidal shape by F(x, y, z) =

x2/a2 ? y2/b2 ? z2/c2 - 1.

The function F partition the space into an inside and

outside (the unit sphere is a good example)

Fðx; y; zÞ ¼\0; if ðx; y; zÞ is in the interior

¼ 0; if ðx; y; zÞ is on the boundary

[ 0; if ðx; y; zÞ is on the exterior

8<: :

This ability to enclose volumes and the ability to represent

blends of volumes endow implicit surfaces with inherent

advantages in geometric shape modeling [18, 34].

3.2 Explicit shapes

An explicit shape representation describes the points that

belong to the object explicitly which makes it the most

intuitive of representations.

A function is defined in a explicit form as

z = f(x, y), where the dependent variable z (on the left-

hand side of the equation) is given ‘‘explicitly’’ in terms of

the independent variables and constants x and y (on the

right-hand side of the equation).

An explicit shape associated with an explicit form can

be represented as

fðx; y; xÞ : z ¼ f ðx; yÞ; ðx; yÞ 2 D � <g:

As mentioned in [27] explicit functions of the form

g = f(p) ‘‘define a scalar field over the R3 space’’, in which

an iso-surface can be derived or ‘‘all the points on the

shape’s surface, inside, and outside it’’ can be considered.

In short, explicit surface representations are well suited for

graphics purposes, but less so for fitting and automated

modeling. The reverse can be said for implicit surface

representations.

3.3 Parametric shapes

Parametric shapes are very popular in computer graphics

mainly because of their easy mathematical manipulation

and simple evaluation. Shape generation using parametric

functions has been motivated by a very good evaluation

of the surface points, and an easy-to-handle coordinate

system and properties. Using parametric representation, the

shape information is transposed into variables by creating

mapping functions. The important types of information

used in a parametric representation are the coordinates and

the topology which relate the geometric shapes to each

other.

For surface modeling, parametric functions with two

parameters are usually used. Parametric representations of

shapes (surfaces and solid objects) can be defined as a set

of points

rðu; vÞ ¼ ðxðu; vÞ; yðu; vÞ; zðu; vÞÞ; ð3Þ

where x, y, and z are the Cartesian coordinates of the

points, u, and v are the parametric coordinates.

The shapes in Fig. 2 can be defined also using a para-

metric representation. The ellipsoid and the sphere can be

defined parametrically by:

xes u; vð Þ ¼ r1 cos u sin v;

yes u; vð Þ ¼ r2 sin u sin v;

zes u; vð Þ ¼ r3 cos v;

ð4Þ

where u; v 2 ½0; 2p�; r1 ¼ 5; r2 ¼ 3; r3 ¼ 2 for the ellipsoid,

r1 = r2 = r3 = 4 for the sphere. The cylinder can be

defined using

xcyl u; vð Þ ¼ r1 cos u;

ycyl u; vð Þ ¼ r2 sin u;

zcyl u; vð Þ ¼ r3v;

ð5Þ

where u; v 2 ½0; 2p�; r1 ¼ r2 ¼ 5; and r3 = 1. A cone and a

truncated cone can be defined using:

Ellipsoid Sphere

ConeCylinder

Fig. 2 Implicit shapes using quadratic implicit (degree 2) surfaces

98 Engineering with Computers (2012) 28:95–107

123

Page 5: An object-oriented approach for mechanical components design and visualization

xcone u; vð Þ ¼ ðr1 � r2u=kÞ cos v;

ycone u; vð Þ ¼ ðr1 � r2u=kÞ sin v;

zcone u; vð Þ ¼ r3u;

ð6Þ

where r = r1 - r2u/k is the radius, v 2 ½0; 2p�; r1 ¼ r2 ¼2; r3 ¼ 3; and k = 3 for the cone, and r3 = 7 for the

truncated cone.

Parametric surfaces can be easily converted to

implicit surfaces (implicit polynomial or algebraic form

F(x, y, z) = 0).

3.4 The shape modeling process

For shape modeling, a blending process (shown in Fig. 6)

based on [26, 28] has been used. Blending is the process by

which two or more shapes are combined to create a new

complex shape. The obtained new shape is a combination

between different shapes, generated using implicit, explicit,

and parametric functions, or their combination. In the

blending process of two different shapes intersection

curves are obtained. Classical ways of generating blends

[22] are

1. in parametric form as presented by Hoffmann [20] and

by Bardis and Patrikalakis [1];

• trim lines blending using interactive or automatic

methods,

• surface blending, i.e., the blending surface is in a

closed form,

• rolling ball blending, i.e., a explicit computation of

a constant radius blend of two surfaces, generating

a tubular surface,

2. in implicit form as presented by Woodwark [46];

• global/unbounded blending, i.e., the mathematical

operations such as intersection or union are

replaced by algebraic approximations,

• volume bounded blending, i.e., the blending region

is prescribed by a volume usually described by its

bounding surfaces,

• range controlled blending,

• rolling ball blending, i.e., a rolling ball is simul-

taneously in contact with two surfaces, generating

a tubular surface,

3. by recursive process as presented by Chaikin [7] and

by Dyn and Levin [14];

4. by numerical methods as described by Bloor and

Wilson [4].

The presented classical ways of generating blends may

represent for some implicit or parametric representations

the fastest and/or the best way to achieve blending. Com-

puting the curves resulting of surface/surface intersections

and generating blends is a general method that will work

well for any type of representation.

Lattice evaluation, marching, algebraic, continuation, and

recursive subdivision methods [15, 36] can be used to obtain

the intersection curves. The algorithm presented in [17] can

be efficiently used to polygonize objects in both implicit and

parametric representation. Since rounding edges and corners

of mechanical parts are used in mechanical engineering to

delimit the domains of machinability of surfaces, a boundary

smoothing (along the intersection curves) is necessary for

rounding the sharp edges. The technique defined in [49] can

been used for smoothing sharp edges with a constant radius.

An example of a boundary smoothing of sharp edges (using

the technique defined in [49]) applied for a rivet with a

cylindrical head has been shown in Figs. 3 and 4.

The technique proposed in [19] has been used for sur-

faces not having constant radius. The method proposed by

[19] has been combined with a curve smoothing process

(along the intersection curves) expressed as in [23]

pri ¼

pr�1i�1

4þ pr�1

i

2þ pr�1

iþ1

4; ð7Þ

where pi-1r-1, pi

r-1, pi?1r-1 are consecutive boundary vertices

at the (r - 1) iteration, and p and q are the boundary

vertices of the meshes, meshes which are to be merged.

Since the previous iteration may lead to a deformed

boundary, a new iteration shown in Fig. 5 was computed

such as the mesh vertices can only be adjusted on the

tangent plane of the surface

p0ri ¼

pr�1i�1

4þ pr�1

i

2þ pr�1

iþ1

4;

dri ¼ p0

ri � pr�1

i ;

pri ¼ p0

ri � ðdr

i � nÞn;

before smoothing after smoothing

(a) (b)

Fig. 3 Effect of smoothing boundary curve. a Cylinders merged

(rivet) without edge smoothing. b Cylinders merged (rivet) with edge

smoothing

before smoothing after smoothing(a) (b)

Fig. 4 Effect of smoothing boundary curve. a Rivet without edge

smoothing. b Rivet with edge smoothing

Engineering with Computers (2012) 28:95–107 99

123

Page 6: An object-oriented approach for mechanical components design and visualization

where n is the surface normal at pir. The number of

iterations are bounded by a termination criterion defined as

in [23]

t�i � tþijt�i jjtþi j

� cos h; ð8Þ

where t�i ¼ n� pri�1 � pr

i

� �; tþi ¼ n� pr

iþ1 � pri

� �and

h = 135�.

Using the shape generation process, complex shapes

(from an initial pool of basic shapes) are created using a

predetermined set of rules a priori defined and pro-

grammed. Once a new shape is created (as illustrated in

Fig. 6) it is added to the library.

The shapes NewObjShppi ; i ¼ 2; 3; . . .; k; p ¼ 1; 2;

3; . . .; n (i is the level where the ith shape was obtained, p is

a counter showing the process number) shown in Fig. 6

represent the ith generated shape geometry, obtained as a

combination of implicit, explicit and parametric functions,

or their combinations. The ith generated shape New-

ObjShpip is obtained from NewObjShpi-1

p and ObjShpip)

as shown in Fig. 6. The shapes ObjShppi ; i ¼ 1; 2; 3; . . .; k

are usually generated using implicit, explicit, and para-

metric functions. The shapes ObjShpip can be also gener-

ated in a different process p = m and level j as

NewObjShpjm, or generated in the same process p as

NewObjShplp but on a previous level l, i.e., l \ i. It is to be

mentioned that one of the advantages of the model is the

simplicity and easiness of developing the final shape

geometry by combining several basic shapes.

The shape components generation and the blending

process shown in Fig. 6 has been applied in the creation of

a rivet, with the rivet head having a conical shape (trun-

cated conical) and shown in Fig. 7. The rivet components

(conical head and cylindrical shaft) have been generated

using Eqs. (5) and (6). The final rivet shape was obtained as

a blending process between the described parametric

functions (or equivalent implicit function) as shown in

Fig. 7.

4 Design and implementation of the application

In the development of the modern tools for the engineering

design, it was estimated that more than two-thirds of

the design activity comprises the reuse of previous design

or design parts [44]. Base on this estimate, the main

challenge in the design of the OOP application is repre-

sented by the integration of predefined logic rules (using

modular knowledge bases and a hierarchical control) with

the defined graphical objects, objects that should describe

both geometric and non-geometric information [32]. The

links between objects is represented in the form of

knowledge rules. The work of Xue and Yand [48] was

considered well-suited to describe knowledge in shape

components generation, i.e., the concepts are organized as

a meta-class level, the generic design libraries are orga-

nized as a class level, and the components are created at the

Fig. 5 The curve smoothing process

2pObjShp 1

NewObjShp 2 = ( phSjbO ObjShp 2)

NewObjShp k = merge ( NewObjShp ,k-1 )

shape functions

q

ObjShp

,1

3ObjShpNewObjShp2

k

ObjShp k

NewObjShp3 = ( ObjShp 3 )NewObjShp ,2

NewObjShpk-1

merge

merge

NewObjShpk

kObjShp

NewObjShp i

p

p

p

p

p

p p

p

iObjShpp

p

Level 2

Level 3

Level i

Level k

p

p

p

p

ppp

Fig. 6 Function-based shape modeling process

100 Engineering with Computers (2012) 28:95–107

123

Page 7: An object-oriented approach for mechanical components design and visualization

instance level. The meta-class knowledge concepts are

classified as: entities, properties, relationships, and tasks.

The class design knowledge describes the generic libraries.

Based on Xue and Yand [48] approach, new libraries such

as Ball Bearings, Gear, and Corkscrew can be defined (or

created) using the existing classes. The classes will account

for any type of shapes (graphical objects) and their rela-

tionships. The components used as instance design

knowledge are created using the libraries of the class

knowledge.

The creation of a component is part of the OOP

approach represented as the OOPUniverse (and presented

in the next section), i.e., the domain where the objects are

defined. In the OOPUniverse new classes are created if

new properties and/or methods are needed. One important

factor in the design of the OOPUniverse was its ‘‘sim-

plicity’’, achieved by the use of the object-oriented para-

digm. For the present work, the components creation (used

as instance design knowledge) is presented in the appli-

cation structure. A further integration of the instance design

knowledge, i.e., Ball Bearings, Gear, Corkscrew, in the

general meta class knowledge concept and class design

knowledge, as designed by Xue and Yand [48], will allow

an intelligent organization of the library of mechanical

components and subsequently suit a great deal of

applications.

The implementation of this work was done in C??

using OpenGL and Qt toolkit. The graphical user interface

(GUI) developed for this project was designed to use

classes that make it easy to draw 3D graphical shapes. As

the viewer is launched, the GUI takes the necessary

information of the OpenGL and Qt and updates it to the

related file. Every time a user issues a command, the proper

class function in the OpenGL is called. Particular attention

was given to the GUI since the main intent was to integrate

all necessary settings in a very simple architecture.

4.1 Structure of the application

The application structure described below allows graphics

objects defined using implicit, explicit, or parametric

generated shapes to be modeled and evaluated. In the

blending process, the shapes are combined to create a new

and more complex component. The obtained final shape

can be visualized and analyzed. The role of the components

are as follows.

The OOPUniverse represents the domain where the

mathematical functions are defined. The main modules of

the OOPUniverse are represented by the ObjDrwgSurf,

TransState, ObjRep, and ObjFinal Rep, as shown in Fig. 8.

The ObjDrwgSurf represents the drawing surface for all

defined OOP objects. The ObjDrwgSurf’s parents shown in

Fig. 8 specify the shape location and scale within the

OOPUniverse.

The NewDefObj component represents a new defined

local object, i.e., a small window in which the objects

(shape components) are placed temporally. This module

serves as a reference class for some other classes defined

below. It contains a reference to a ObjRep object repre-

sentation described below. Instances of the class contain

information of the object location inside a Cartesian ref-

erence frame and object size.

Obj Shp1

NewObjShp2 = ,merge

Cylinder

Union

Intersection

Cone

TruncatedCone

Half Space

1

Obj Shp21

1 (Obj Shp11

NewObjShp21 Obj Shp3

1

NewObjShp3 )(= ,merge1 Obj Shp2

1

)Obj Shp21

NewObj Shp21

Fig. 7 Function-based shape

modeling of a rivet with

a conical head

Engineering with Computers (2012) 28:95–107 101

123

Page 8: An object-oriented approach for mechanical components design and visualization

The ObjRep component represents a local object (a new

window placed above the NewDefObj) in which all the

related information about the shapes, consecutively placed

on the ObjDrwgSurf, are maintained. By using the graph-

ical interface, the objects are placed on the display as

separate components, preventing the duplication of screen

information within every NewDefObj.

The ObjTrans component represents objects that contain

information describing the physical world, mainly the

associated six-degrees-of freedom screen and scale (view

capabilities).

The TransState component represents the object state

from implementation to visualization.

The ObjDataCode component represents the file format

used for function representation.

The ObjFinalRep component represents the final shape

representation as shown in Fig. 8.

The ObjGeom, ObjApp, and ObjProp contain informa-

tion about the geometry and material properties assigned to

a new generated shape, information related to ObjRep by

‘‘inheritance’’ and ‘‘part off’’ concepts defined in the pre-

vious section.

4.2 Implementation of the OOP application

components

Regarding the implementation of the application compo-

nents used to generate shapes, the next classes representing

the basic structure of the OOP code have been used.

• ObjShpMApp The OOP main class which creates a

ObjShpPan object.

• ObjShpPan This is the class that actually corresponds

to the panel included in the ObjShpMApp class, the

main panel that display the shapes. This class serves as

the main controller of the application, displaying and

storing the shapes during OOP code execution, and

providing methods to query and to update the data as

well as some other variables related to the shapes. It

also contains the main menu of the user at the top, and a

large box for shape representation underneath.

• ObjCtrlPan The thin horizontal panel at the top of the

ObjShpPan containing the elements of the graphical

user interface, used for the standardized data (object

function) manipulation.

• ObjDrgShp The drawing area of the generated shapes.

• ObjDrgTrans, ObjDrgScl, ObjDrgShr, ObjDrgRtate

These class objects (that handle mouse dragging

events) allow the user to translate, scale, shear, and

rotate the generated shapes in the ObjDrgShp drawing

area window.

• ObjCoordShp This class defines the coordinates of a

new generated shapes. A Cartesian coordinate system is

used to keep track of the position and other properties

of the generated shapes

• ObjShpFnc This class incorporates the implicit, expli-

cit, and parametric mathematical functions used to

generate the shapes. Only highly specialized code, as

shape functions calculations, is implemented in these

classes. The translation, scale, shear, and rotation

matrices are also implemented here.

• ObjCtc It is a class that contains all the defined methods

concerning the contact interfaces between two shapes,

including the contact law such as direction of contact

and contact plane.

Fig. 8 The OOP application structure: rounded boxes are used to

represent the initial, intermediate, and final state of a graphical object;

squared boxes are used to represent object information and properties

Material

Elastic Material Elastoplastic Material

# Young, Poisson, Density: Real# DampingRatio: Real# ThermalExpansionCoefficient: Real# Name: String

+ computeValues( ): void+ checkValues( ): void

# K1, K2, gamma: Real

+ getYieldStress( ): Real+ getDerYieldStress( ): Real+ getType: Indice+ getName: String+ isYield: Boolean

+ getYieldStress( ): Real+ getDerYieldStress( ): Real+ getType: Indice+ getName: String+ isYield: Boolean

Fig. 9 UML diagram of the class Material

102 Engineering with Computers (2012) 28:95–107

123

Page 9: An object-oriented approach for mechanical components design and visualization

• ObjMatShp It is an abstract class used for shape

matting. The class provides methods for shape blending

after using the contact ObjCtc class.

• ObjRefreshShp It is a class that refresh instanced shapes

of hierarchical referenced objects. This class is used in

connection with ObjCoordShp class, for defining the

2ObjShp

Sphere

3

3

NewObjShp3 )(=

ObjShp

,mergeSphere

3

3

4ObjShp

Sphere

3

NewObjShp22

NewObjShp21

ObjShp3 =3

2ObjShp3

ObjShp4 =3

2ObjShp3

NewObjShp23

NewObjShp33

3ObjShp 3NewObjShp 23

ObjShp1 =3 NewObjShp2

1

NewObjShp2 )(= ,merge32ObjShp 3NewObjShp 2

1

NewObjShp4 )(= ,merge34ObjShp 3NewObjShp 3

3

NewObjShp163

Sphere

NewObjShp17 )(= ,merge3 NewObjShp 163 NewObjShp 2

2

ObjShp 17 =3

NewObjShp22

Fig. 10 Function-based shape

modeling process of the radial

ball bearing

Engineering with Computers (2012) 28:95–107 103

123

Page 10: An object-oriented approach for mechanical components design and visualization

coordinates of the newly created shape. It is always

used after a blending process was performed using the

ObjMatShp class.

• ObjMat It is an abstract class serving as a base class for

two subclasses, ObjElstMat and ObjElstplstMat, that

provide an interface for material handling (derived

classes available in the OOP program). The derived

classes define material properties attached to a new

generated shape. The derived classes contain the basic

properties of a large number of materials, such as

density, elastic modulus (Young’s Modulus), Poisson’s

ratio, Damping Ratio, and thermal expansion coeffi-

cient. The UML diagram regarding the class ObjMat is

presented in Fig. 9. Depending on how the classes are

defined, some attributes and methods, such as density,

elastic modulus, Poisson’s ratio, common to each kind

of material may be implemented in the base class, while

other attributes or methods (more specific) are imple-

mented in the derived classes, as shown in Fig. 9.

5 Application examples using the OOP approach

In this section, two examples are presented to illustrate the

design and visualization of different mechanism compo-

nents. The shapes have been generated using parametric,

implicit, and explicit functions or their combinations.

Example 1 (ball bearings generation) Ball bearings play

an important role in aircraft and aerospace systems, fuel

control systems, or commercial airplanes, military guid-

ance systems, and other types of aerospace systems.

A ball bearing has been obtained using the blending

process between the shapes NewObjShp12;ObjShp3

i ; i¼1...n;

n¼15 (having 15 identical spherical shapes), and New-

ObjShp22 as shown in Fig. 10.

The shape NewObjShp21 was generated in a different

process, i.e., NewObjShpip where p = 1 and i = 2, as

shown in Fig. 11. The shape NewObjShp22 was also gen-

erated in a different process, i.e., NewObjShpip for p = 2

and i = 2, as shown in Fig. 12. Each process uses a

cylindrical surface (generated using Eq. (5)) and a torus to

obtain the final shape. The torus, having the z axis as the

2ObjShp1

NewObjShp 2= ( )

ObjShp

,mergeTorus

1

11

2ObjShp1ObjShp11

Intersection

Cylinder

Fig. 11 Function-based shape

modeling process of the ball

bearing outer race

2

ObjShp 1

NewObjShp 2= ( )

ObjShp

,merge

Intersection

Cylinder

Torus2

2

2

ObjShp 12

2ObjShp2

Fig. 12 Function-based shape

modeling process of the ball

bearing inner race

Shape 8Shape 7

Shape 9

Shape 11Shape 10

Shape 12

Shape 2Shape 1

Shape 3

Shape 5Shape 4

Shape 6

Shape 14Shape 13

Shape 15

Shape 17Shape 16

Shape 18

Fig. 13 A radial ball bearing

104 Engineering with Computers (2012) 28:95–107

123

Page 11: An object-oriented approach for mechanical components design and visualization

axis of revolution, was generated by the parametrically

function:

x u; vð Þ ¼ Rþ r cos vð Þ cos u;

y u; vð Þ ¼ Rþ r cos vð Þ sin u;

z u; vð Þ ¼ r sin v;

ð9Þ

where u; v 2 ½0; 2p�;R is the distance from the center of the

tube to the axis of revolution (center of the torus), and r is

the radius of the tube. The 3D visualization of the radial

ball bearing is shown in Fig. 13.

Example 2 (corkscrew shape generation) The blending

process have been illustrated using a seashell-type surface

generated by a parametric function, a cylinder generated by

a implicit function, and a handle obtained as a blending

process between two implicit shapes. A total of four

operations have been applied to the parts to obtain the

corkscrew surface inside the graphical interface. More

specifically, using a seashell-type surface, a cylindrical

surface, and a handle surface as shown in Fig. 15, a

Corkscrew Shape is obtained.

The seashell surface shown in Fig. 15 has been gener-

ated using the next parametric function

xshs u; vð Þ ¼ 2 1� eu

2kp� �

c½u�c2 v

2

h i;

yshs u; vð Þ ¼ 2 �1þ eu

2kp� �

s½u�c2 v

2

h i;

zshs u; vð Þ ¼ 1� eu

kp � s½v� þ eu

2kps½v�:

ð10Þ

The cylinder shown in Fig. 15 has been generated using

Eq. (5). The handle was obtained in a different process

shown in Fig. 14 as a blending between the next two

implicit functions (a sphere and a cylinder),

Fshðx; y; zÞ ¼ ðx2 þ y2 þ z2Þ1=2 � rs;

Gshðx; y; zÞ ¼ ðx2 þ y2Þ1=2 � rc:ð11Þ

The blending rule was defined as in [3]

Hshðx; y; zÞ ¼ 1� 1� Fshðx; y; zÞd1

� �t

þ� 1� Gshðx; y; zÞ

d1

� �t

þ;

ð12Þ

1

NewObjShp1 = ( ObjShp1 )

ObjShp

ObjShp ,1mergeSphere2

2

Cylinder

1ObjShp1

1 2

Union

Fig. 14 Function-based shape

modeling process of the handle

2

NewObjShp2= ( ObjShp2)

ObjShp

ObjShp ,1mergeCylinder2

2

2

NewObjShp 3 )(= ,merge

Corkscrew

Surface

Handle

2

2

1ObjShp2

NewObjShp21

2 2

NewObjShp

22NewObjShp 2

1NewObjShp

ObjShp3 = 2 NewObjShp2

1

Union

Seashell

Fig. 15 Function-based shape

modeling process of the

corkscrew

Engineering with Computers (2012) 28:95–107 105

123

Page 12: An object-oriented approach for mechanical components design and visualization

where d1 is the first shape distance along the x axis, d2 is

the second shape distance along the x axis, and where

[*]? = max(0,*) limiting the resulting shape to the first

quadrant. The super-elliptical blend resulting final shape

[3], i.e., half of the handle, is given by

Hshðx; y; zÞ ¼ 4� 4� ðx2 þ y2Þ1=2h i3

þ

� 7� ðx2 þ y2 þ z2Þ1=2h i3

þ; ð13Þ

where d1 = d2 = 1, the sphere radius is rs = 5, and the

cylinder radius is rc = 2.

To each part of the corkscrew (which are typically

made of metal), it was assigned a material using the class

ObjMat. For the handle (a nonmetallic part), a nonme-

tallic material was assigned using the same class ObjMat.

Since a different color is assigned to each material, the

difference in color for a metallic part (the seashell sur-

face) and a nonmetallic part (the handler) can be seen in

Fig. 16.

6 Conclusions

In this paper, an OOP approach for mechanism components

modeling and visualization is proposed. An OOP application

was developed. Parametric, explicit, and implicit or their

combination, defined on the graphic interface and viewed

as OOP objects, have been used to generate mechanical

components shapes.

Different mechanical components and mechanical sys-

tems such as corkscrews and ball bearings have been

generated and visualized. Simple geometry as well as

complex combination of the 3D shapes was provided.

The presented graphical representations demonstrate the

advantages of using this software for teaching engineering

subjects, especially when interactive presentation and

graphical visualization is necessary.

It was demonstrated that simple mathematical functions

represent useful tools for shape modeling and visualization.

Furthermore, there is much room for improvements; the

presented models do not indicate the limit in shape

(mechanical components) generation.

References

1. Bardis L, Patrikalakis NM (1989) Blending rational b-spline

surfaces. Eurographics 89:453–462

2. Bloomenthal J (1988) Polygonization of implicit surfaces.

Comput Aided Geom Des 5(4):341–355

3. Bloomenthal J (eds) (1997) Introduction to implicit surfaces.

Morgan Kaufmann Publishers Inc., San Francisco

4. Bloor MIG, Wilson MJ (1989) Generating blend surfaces using

partial differential equations. Comput Aided Des 21:165–

171

5. Campbell M, Cheng HH (2007) Teaching computer-aided

mechanism design and analysis using a high-level mechanism

toolkit. Comput Appl Eng Educ 15:277–288

6. Cartwright R, Adzhiev V, Pasko A, Goto Y, Kunii TL (2005)

Web-based shape modeling with HyperFun. Computer graphics

and applications, IEEE, pp 60–69

7. Chaikin GM (1974) An algorithm for high speed curve genera-

tion. Comput Graphics Image Process 3:346–349

8. Cheng HH, Trang DT (2006) Object-oriented interactive mech-

anism design and analysis. Eng Comput 21:237–246

9. Cojocaru D, Karlsson AM (2008) An object-oriented approach

for modeling and simulation of crack growth in cyclically loaded

structures. Adv Eng Softw 39:995–1009

10. Collins CL, McCarthy JM, Perez A, Su H (2002) The structure of

an extensible Java applet for spatial linkage synthesis. J Comput

Inf Sci Eng 2(45):45–50

11. de Figueiredo LH (1996) Surface intersection using affine arith-

metic. In: Proceedings of graphics interface’96, pp 168–175

12. Dupac M (2007) Mechanism components generation and visu-

alization using mathematical functions. In: Proceedings of the

2007 ASME early career technical conference (CD-ROM)

13. Dupac M, Popirlan CI (2010) Web technologies for modelling

and visualization. In: Shkelzen Cakaj (ed) Mechanical engi-

neering, modeling simulation and optimization—tolerance and

optimal control. ISBN: 978-953-307-056-8, InTech

14. Dyn N, Levin D (2002) Subdivision schemes in geometric

modeling. Acta Numer 11:73–144

15. Farin GE, Hoschek J, Kim M-S (2002) Handbook of computer

aided geometric design. Elsevier, Amsterdam

16. Fayolle P-A, Schmitt B, Goto Y, Pasko A (2005) Web-based

constructive shape modeling using real distance functions. IEICE

Trans Inf Syst E88D(5):828–835

17. Fougerolle Y, Gribok A, Foufou S, Truchetet F, Abidi M (2005)

Boolean operations with implicit and parametric representation of

primitives using R-functions. IEEE Trans Vis Comput Graphics

11(5):529–539

18. Hartmann E (1995) Blending an implicit with a parametric sur-

face. Comput Aided Geom Des 12:825–835

19. Hatna A, Grieve RJ, Broomhead P (2001) Surface blending for

machining purposes: a brief survey and application for machining

compound surfaces. J Eng Manuf 215(10):1397–1408

Shape 2Shape 1

Shape 3

Shape 5Shape 4

Fig. 16 Corkscrew final shape

106 Engineering with Computers (2012) 28:95–107

123

Page 13: An object-oriented approach for mechanical components design and visualization

20. Hoffmann CM (1990) Algebraic and numerical techniques for

offsets and blends. In: Dahmrn W, Gasca M, Micchelli CA (eds).

Kluwer, Dordrecht, pp 499–528

21. Hoffmann C (1993) Implicit curves and surfaces in computer

aided geometric design. IEEE Comput Graphics Appl 13(1):

79–88

22. Hoschek J, Lasser D (1993) Fundamentals of computer aided

geometric design. Taylor & Francis, London

23. Hui KC, Lai YH (2006) Smooth blending of subdivision surfaces.

Comput Aided Des 38:786–799

24. Kromera V, Dufosseb F, Gueurya M (2005) On the implemen-

tation of object-oriented philosophy for the design of a finite

element code dedicated to multibody systems. Finite Elem Anal

Des 41:493–520

25. Larson J, Cheng HH (2000) Object-oriented cam design through

the internet. J Intell Manuf 11(6):515–534

26. Lee T, Bedi S, Dubey RN (1993) A parametric surface blending

method for complex engineering objects. In: Proceedings on the

2nd ACM symposium on solid modeling and applications, SMA

’93. ACM, New York, pp 179–188

27. Levinski K, Sourin A (2007) Interactive function-based shape

modelling. Comput Graphics 31:66–76

28. Liu Q, Sourin A (2006) Function-based shape modelling exten-

sion of the Virtual Reality Modelling Language. Comput

Graphics 30(4):629–645

29. Liu Z, Wang Z, Tan J, Fu Y, Wan C (2006) A virtual environ-

ment simulator for mechanical system dynamics with online

interactive control. Adv Eng Softw 37(10):631–642

30. Mackie RI (2004) Extensibility of finite element class systems—a

case study. Comput Struct 82(23–26):2241–2249

31. Metaxas D (1996) Physics-based deformable models. Kluwer,

Dordrecht

32. Motza DS, Haghighi K (1991) A knowledge-based design model

for mechanical components. Eng Appl Artif Intell 4(5):351–358

33. Pantale O, Caperaa S, Rakotomalala R (2004) Development of an

object-oriented finite element program: application to metal-

forming and impact simulations. J Comput Appl Math 168:

341–351

34. Pasko G, Pasko A, Kunii T (2005) Bounded blending for function-

based shape modeling. IEEE Comput Graph Appl 25(2):36–45

35. Popirlan C, Dupac M (2008) A web-based approach for 3D mecha-

nism components modeling and visualization. In: Proceedings of the

17th IASTED international conference on applied simulation and

modelling, paper no. 609-080, pp 123–129

36. Pratt MJ, Geisow AD (1986) Surface/surface intersection prob-

lems. In: Gregory JA (eds) The mathematics of surfaces, vol 16.

Clarendon Press, Oxford, pp 117–142

37. Qiao H (2006) Object-oriented programming for the boundary

element method in two-dimensional heat transfer analysis. Adv

Eng Softw 37:248–259

38. Santos C (1994) Design and implementation of an object-oriented

view mechanism. GOODSTEP ESPRIT–III No. 6115, GOOD-

STEP Technical Report No. 7, pp 1–22

39. Sederberg T (1983) Implicit and parametric curves and surface

for computer-aided geometric design. PhD dissertation, Purdue

University

40. Seth A, Su H-J, Vance JM (2006) SHARP: a system for haptic

assembly and realistic prototyping. In: Proceedings of the

DETC’06/CIE-99476, pp 1–9

41. Siemers A, Fritzson D (2009) Visualisation and data represen-

tation for large scale multibody simulations with detailed contact

analysis: a case study. Simul Model Pract Theory 17:1130–1142

42. Su H, Collins C, McCarthy JM (2002) An extensible Java applet

for spatial linkage synthesis. In: Proceedings of DETC2002/

MECH-34371, pp 1–8

43. Terzopoulos D, Metaxas D (1991) Dynamic 3D models with local

and global deformations: deformable superquadrics. IEEE Trans

Pattern Anal Mach Intell 13:703–714

44. Ullman DG (1997) The mechanical design process, 2nd edn.

McGraw-Hill, New York

45. Unsalan C, Ercil A (2001) Conversions between parametric and

implicit forms using polar/spherical coordinate representations.

Comput Vis Image Underst 81(1):1–25

46. Woodwark JR (1987) Blends in geometric modeling. In: Martin

RR (ed) The mathematics of surfaces. Oxford University Press,

Oxford, pp 255–297

47. Woonga M, Chaa J-H, Parka J-H, Kangb M (1999) Development

of an intelligent design system for embodiment design of

machine tools. CIRP Ann Manuf Technol 48(1):329–332

48. Xue D, Yang H (2004) A concurrent engineering-oriented design

database representation model. Comput Aided Des 36:947–965

49. Yan Y, Tan ST (2004) Adding draft angles on mechanical com-

ponents containing constant radius blending surfaces. Comput

Aided Des 36:565–580

Engineering with Computers (2012) 28:95–107 107

123