0% found this document useful (0 votes)
29 views15 pages

Computer Science For Digital Engineering Assignment Report

This report presents two tasks demonstrating the application of computer science in digital engineering: a C++ program for calculating cosine similarity and a CAD design of a 3D pencil model. The C++ program effectively measures text similarity using established algorithms, while the CAD design showcases the creation of a detailed and accurate pencil model, incorporating text and color customization. Both tasks highlight the integration of theoretical concepts into practical applications in engineering.

Uploaded by

yashmittal0195
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views15 pages

Computer Science For Digital Engineering Assignment Report

This report presents two tasks demonstrating the application of computer science in digital engineering: a C++ program for calculating cosine similarity and a CAD design of a 3D pencil model. The C++ program effectively measures text similarity using established algorithms, while the CAD design showcases the creation of a detailed and accurate pencil model, incorporating text and color customization. Both tasks highlight the integration of theoretical concepts into practical applications in engineering.

Uploaded by

yashmittal0195
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1

Essay / Assignment Title: Computer Science for Digital Engineering


Assignment Report

Programme title: Computer Science For Digital Engineering (With C+


+; CAD)

Name: Om Dattatray Varute

Year: 2024
2

CONTENTS

1. Introduction

2. Task 1: C++ Program for Cosine Similarity Calculation

o 2.1 Understanding Cosine Similarity

o 2.2 Algorithm Implementation

o 2.3 Programming Approach

o 2.4 Results and Analysis

3. Task 2: CAD Design of a 3D Object

o 3.1 Design Concept

o 3.2 2D Design Development

o 3.3 Creating the 3D Model

o 3.4 Customization with Text and Color

o 3.5 Final Design Review

4. Conclusion

5. References
3

Statement of compliance with academic ethics and the avoidance of


plagiarism

I honestly declare that this dissertation is entirely my own work and none of its part has been copied
from printed or electronic sources, translated from foreign sources and reproduced from essays of
other researchers or students. Wherever I have been based on ideas or other people texts I clearly
declare it through the good use of references following academic ethics.

(In the case that is proved that part of the essay does not constitute an original work, but a copy of
an already published essay or from another source, the student will be expelled permanently from
the postgraduate program).

Name and Surname (Capital letters):

......... Om Dattatray Varute..................................................................................................................

Date: ...........14........../..03......../...2025......
4

1. Introduction

Computer science plays a vital role in modern digital engineering. This report presents two

different tasks that showcase the application of computer science concepts in practical

scenarios. The first task involves creating a C++ program to calculate the cosine similarity

between two text inputs. Text similarity measures help us understand how close two

documents are in meaning (Manning et al., 2008). The second task demonstrates the use of

CAD software to design a 3D pencil model. Computer-aided design helps engineers create

precise digital models before manufacturing (Narayan, 2008). Both tasks highlight different

aspects of computer science in digital engineering fields. This report will explain the

implementation processes, challenges faced, and results achieved through detailed

documentation and analysis.

2. Task 1: C++ Program for Cosine Similarity Calculation

2.1 Understanding Cosine Similarity

Cosine similarity measures the similarity between two non-zero vectors. It calculates the

cosine of the angle between them. Two identical texts will have a cosine similarity of 1.

Completely different texts will have a value of 0 (Singhal, 2001). The formula uses the dot

product of two vectors divided by their magnitudes. Cosine similarity works well for text

analysis because it focuses on content rather than size. This makes it useful for comparing

documents of different lengths. The mathematical formula looks like this: cos(θ) = (A·B)/(|A|

×|B|) where A and B represent our text vectors (Huang, 2008). Many search engines and

recommendation systems use this method today. It helps find related documents based on

their content similarity.

Text documents need to be converted into vectors first. Each unique word becomes a

dimension in the vector space. The frequency of each word becomes the value in that
5

dimension. This approach is called the "bag of words" model. It ignores word order but

preserves frequency information (Rajaraman and Ullman, 2011). Higher cosine similarity

values mean the texts contain similar words. Lower values suggest different vocabulary and

likely different topics. The calculation gives results between 0 and 1 for normal text analysis.

This makes the results easy to understand as percentages of similarity.

2.2 Algorithm Implementation

The cosine similarity algorithm follows several clear steps. First, we tokenize both input texts

into individual words. Tokenization breaks down sentences into separate words for analysis

(Bird et al., 2009). Next, we count the frequency of each word in both texts. These

frequencies form our vector representations of the texts. We then identify all unique words

across both documents. This gives us the dimensions of our vector space model. The dot

product calculation multiplies matching word frequencies together. We sum these products to

get the final dot product value (Garcia, 2016).

For the magnitude calculations, we square each word frequency. We sum these squares for

each document separately. Then we take the square root of these sums. This gives us the

magnitude (length) of each document vector. Finally, we divide the dot product by the

product of both magnitudes (Turney and Pantel, 2010). This normalization step ensures our

result falls between 0 and 1. The entire process focuses on word overlap between documents.

It works well for detecting semantic similarity in short texts. Our implementation follows this

standard approach to text similarity calculation.

2.3 Programming Approach

The C++ program uses several standard libraries for implementation. The iostream library

handles input and output operations. The map container stores word frequencies as key-value

pairs. Stringstream helps with text parsing and word extraction. The cmath library provides
6

mathematical functions like square root (Stroustrup, 2013). The set container stores unique

words from both texts. The iomanip library helps format the output display nicely. These

standard libraries make the code more efficient and readable. They provide built-in

functionality for complex data structures and operations.

The program includes three main functions for clear organization. The getWordFrequency

function counts words in each text input. The computeCosineSimilarity function performs the

mathematical calculations described earlier. The displayResult function shows the final

similarity score visually. This modular approach makes the code easier to understand

(McConnell, 2004). The main function coordinates the overall program flow. It collects user

input and calls the other functions in sequence. The program handles edge cases like empty

inputs appropriately. It also formats the output inside a rectangle for better presentation.

Figure 1: Screenshot of Cosine Similarity Program Output for Example 1


7

Figure 2: Screenshot of Cosine Similarity Program Output for Example 2

Figure 3: Final Screenshot of Complete Eclipse Interface

2.4 Results and Analysis

The program successfully calculates cosine similarity between text inputs. In the first test

case, we compared "Machine learning is powerful" with "Machine learning is amazing". The

result showed a cosine similarity of 0.7500. This high score makes sense because the texts

share many words. Only one word differs between them, which explains the similarity
8

(Mihalcea et al., 2006). The second test compared longer and more different texts. It returned

a lower similarity score of 0.4146. This correctly reflects the reduced word overlap between

inputs. The program handles these different cases accurately and consistently.

The rectangular display format makes the results easy to read. Users can quickly see the

similarity score in a highlighted box. The precision is set to four decimal places for accuracy.

This provides enough detail without overwhelming the user (Nielsen, 2000). The program

processes inputs efficiently even with longer texts. It handles special characters and maintains

case sensitivity as designed. The algorithm implementation follows established information

retrieval principles. It successfully captures semantic similarity between different text inputs.

Testing with various examples confirmed the program's reliability and accuracy.

3. Task 2: CAD Design of a 3D Object

3.1 Design Concept

The 3D object design task focused on creating a pencil. Pencils are familiar objects with

interesting design features. They combine geometric shapes in a functional form. The pencil

design includes a hexagonal body and conical tip. These features make it a good subject for

CAD modeling. The design would include "OM Pencils" text and "HB" marking. These

elements add realism and personalization to the model (Bethune, 2017). The pencil represents

an everyday object with precise specifications. It demonstrates both artistic and technical

design aspects.

The initial concept started with standard pencil dimensions. Regular pencils measure about

19cm in length and 7mm in width. These measurements provided a starting point for the

design. The hexagonal body helps prevent rolling on flat surfaces. The sharp conical tip

represents the writing point (Pipes, 2007). The eraser component was omitted for simplicity.

This focused the design on the main pencil body. The text placement needed careful
9

consideration for visibility. The "HB" marking indicates pencil hardness in real-world

applications. This attention to detail makes the model more authentic.

3.2 2D Design Development

The 2D design began in AutoCAD with basic shape creation. The pencil's hexagonal profile

forms the basis of the design. The hexagon was drawn using the polygon tool with six sides.

Proper dimensions ensured the design matched standard pencil proportions (Yarwood, 2016).

The pencil tip was drawn as a triangle at one end. This would later be revolved to create the

conical shape. The dimensions were carefully labeled for manufacturing clarity. This detailed

2D drawing established the foundation for the 3D model.

Figure 4: 2D Design of Pencil with Dimensions and Labels

The 2D drawing included guidelines for text placement. The "OM Pencils" text would appear

along the body length. The "HB" marking would appear near one end of the pencil. These

text elements were positioned for maximum visibility (Bethune, 2017). The drawing used

proper CAD conventions for clarity. Lines were drawn on appropriate layers with consistent
10

styles. The completed 2D design contained all necessary information for 3D modeling. This

thorough preparation made the next steps more efficient.

3.3 Creating the 3D Model

Converting the 2D design to 3D required several modeling techniques. The hexagonal profile

was extruded to create the pencil body. Extrusion converts 2D shapes into 3D objects with

depth (Tickoo, 2014). The triangular tip was revolved around its axis. This created the conical

pencil point with proper dimensions. The sharp tip was crucial for realistic appearance. The

transition between body and tip needed careful attention. The model maintained proper

proportions throughout the development process.

Figure 4: 3D Model of Pencil Showing Complete Structure

The 3D model required precise angle measurements for the tip. Standard pencils have

approximately 30-degree tip angles. The digital model followed this specification for

accuracy (Yarwood, 2016). The hexagonal body maintained consistent dimensions along its

length. The edges were slightly beveled for realism. These small details improved the visual
11

quality of the model. The CAD software's measurement tools ensured dimensional accuracy.

Every aspect of the pencil followed real-world specifications for authenticity.

3.4 Customization with Text and Color

Adding text to the 3D model required specific CAD tools. The text tool created the "OM

Pencils" label along the body. The text followed the pencil's contour for natural appearance.

The "HB" marking was added near the hexagonal end. Both text elements used appropriate

font styles and sizes (Cohn, 2018). The text depth was set for clear visibility. This ensured the

text would appear properly in all viewing angles. The text positioning followed standard

pencil labeling conventions. This attention to detail enhanced the model's professional

appearance.

Color customization made the model more visually appealing. The pencil body received a

gray color resembling graphite. The tip area featured a subtle orange color for the wood.

These color choices reflected real-world pencil materials (Bethune, 2017). The text elements

were colored white for contrast. This made them easily readable against the darker body. The

color application used the CAD software's material tools. These tools allowed precise control

over color placement. The finished model combined accurate geometry with appropriate

coloring. This created a visually realistic pencil representation.

3.5 Final Design Review

The completed 3D pencil model successfully met all requirements. It featured accurate

dimensions matching real-world specifications. The hexagonal body and conical tip showed

proper proportions. The text elements appeared clearly on the model surface. The color

scheme enhanced visual realism effectively (Cohn, 2018). The model demonstrated good

attention to detail throughout. It successfully represented a common object in digital form.


12

The CAD implementation showed proper use of modeling techniques. The design achieved

both functionality and visual appeal.

The final review revealed some potential improvements for future models. The eraser end

could be added for completeness. More texture details could enhance surface realism.

Advanced material properties could improve visual rendering (Tickoo, 2014). However, the

current model fulfills all assignment requirements successfully. It demonstrates competent

use of CAD design principles. The model showcases both technical accuracy and aesthetic

considerations. It serves as a good example of 3D object design. The documentation captures

all important aspects of the design process.

Figure 5: Final Rendered View of Colored Pencil with Text

4. Conclusion

This assignment demonstrated practical applications of computer science in digital

engineering. The C++ program successfully implemented cosine similarity calculations. It

processed text inputs and displayed meaningful similarity scores. The program handled

various test cases accurately and efficiently. The cosine similarity algorithm proved effective
13

for text comparison tasks. The visual display enhanced user understanding of the results. This

implementation demonstrates practical applications of information retrieval concepts. It

shows how mathematical concepts translate into useful software tools (Baeza-Yates and

Ribeiro-Neto, 2011).

The CAD design portion showcased 3D modeling capabilities. The pencil model progressed

from 2D concept to detailed 3D object. It incorporated text elements and color customization

successfully. The model maintained accurate proportions and realistic features. The design

process followed professional CAD practices throughout. This demonstrated the value of

computer-aided design in engineering. It showed how digital tools help create precise

manufacturing specifications. Both tasks highlighted different aspects of computer science

applications. They demonstrated technical skills relevant to digital engineering fields.

This assignment provided valuable learning experiences in programming and design. It

showed how theoretical concepts apply to practical challenges. The skills developed here

transfer to many engineering disciplines. They help bridge the gap between computer science

and physical engineering. Future work could explore more advanced implementations of both

tasks. The programming component could incorporate more sophisticated text processing.

The CAD design could explore more complex geometric forms. These projects demonstrate

the growing integration of computer science. They show its essential role in modern digital

engineering practices.
14

5. References

Baeza-Yates, R. and Ribeiro-Neto, B. (2011) Modern Information Retrieval: The Concepts

and Technology Behind Search. 2nd edn. Harlow: Addison-Wesley. Available at:

https://doi.org/10.1145/2009916.2010148

Bethune, J.D. (2017) Engineering Graphics with AutoCAD 2018. New York: Industrial Press.

Available at: https://www.industrialpress.com/engineering-graphics-with-autocad-2018.html

Bird, S., Klein, E. and Loper, E. (2009) Natural Language Processing with Python.

Sebastopol: O'Reilly Media. Available at: https://www.oreilly.com/library/view/natural-

language-processing/9780596803346/

Cohn, D. (2018) AutoCAD 2019 and AutoCAD LT 2019 Essentials. Indianapolis: Wiley.

Available at:

https://www.wiley.com/en-us/AutoCAD+2019+and+AutoCAD+LT+2019+Essentials-p-

9781119495475

Garcia, E. (2016) 'Cosine similarity tutorial', Information Retrieval Blog, 14 March. Available

at: http://www.minerazzi.com/tutorials/cosine-similarity-tutorial.pdf

Huang, A. (2008) 'Similarity measures for text document clustering', Proceedings of the New

Zealand Computer Science Research Student Conference, pp. 49-56. Available at:

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.332.4480&rep=rep1&type=pdf

Manning, C.D., Raghavan, P. and Schütze, H. (2008) Introduction to Information Retrieval.

Cambridge: Cambridge University Press. Available at:

https://doi.org/10.1017/CBO9780511809071
15

McConnell, S. (2004) Code Complete: A Practical Handbook of Software Construction. 2nd

edn. Redmond: Microsoft Press. Available at:

https://www.microsoftpressstore.com/store/code-complete-9780735619678

Mihalcea, R., Corley, C. and Strapparava, C. (2006) 'Corpus-based and knowledge-based

measures of text semantic similarity', Proceedings of the 21st National Conference on

Artificial Intelligence, pp. 775-780. Available at:

https://www.aaai.org/Papers/AAAI/2006/AAAI06-123.pdf

Narayan, K.L. (2008) Computer Aided Design and Manufacturing. New Delhi: Prentice Hall

of India. Available at: https://books.google.com/books?id=6-8vBQAAQBAJ

Nielsen, J. (2000) Designing Web Usability: The Practice of Simplicity. Indianapolis: New

Riders Publishing. Available at: https://www.nngroup.com/books/designing-web-usability/

Pipes, A. (2007) Drawing for Designers. London: Laurence King Publishing. Available at:

https://www.laurenceking.com/products/drawing-for-designers

Rajaraman, A. and Ullman, J.D. (2011) Mining of Massive Datasets. Cambridge: Cambridge

University Press. Available at: https://doi.org/10.1017/CBO9781139058452

Singhal, A. (2001) 'Modern information retrieval: A brief overview', IEEE Data Engineering

Bulletin, 24(4), pp. 35-43. Available at: http://singhal.info/ieee2001.pdf

Stroustrup, B. (2013) The C++ Programming Language. 4th edn. Boston: Addison-Wesley.

Available at: https://www.stroustrup.com/4th.html

You might also like