Giter Site home page Giter Site logo

treeleaf_cpp's Introduction

Student Records and 3D Box Transformations

Overview

This repository contains two tasks:

  1. CSV Student Records Sorting: A program that reads student records from a CSV file and sorts the data based on name and age.
  2. 3D Box Transformations: A program that performs transformations (rotation and scaling) on a 3D box represented by its vertices.

Assumptions and Requirement

  • The input CSV file follows the format: id,name,date_birth,roll_no,department,address.
  • For the transformations, angles should be in degrees and the scaling factor should be a positive number.

Platform and environment

  • Compiled and tested on x86_64-pc-linux-gnu with clang version 18.1.8

Task 1: CSV Student Records Sorting

Approach

  1. Reading CSV File: The program reads a CSV file containing student records and parses each row to create Student objects.
  2. Sorting: The records can be sorted by name or by age. Age is calculated from the date of birth.
  3. Exporting: The sorted data is exported to new CSV files.

Instructions

  1. Compile and Run:

    clang++ -o csvsort csv_sort.cpp
    ./csvsort input.csv [sortby]
    • input.csv: The CSV file containing student records.
    • [sortby]: Sorting criteria (age, name, or both). For help:
    ./csvsort -h
  2. Example Usage:

    ./csvsort students.csv age

    This will generate SortedByAge.csv.

Task 2: 3D Box Transformations

Approach

  1. Vertex and Box Representation: The box is represented using Vertex and Box classes.
  2. Transformations: The Transformation class performs rotations about the X, Y, and Z axes and scaling based on user input.
  3. Transformation Method: Matrix multiplication is used for transformation

Note: The Vertex structure has been updated to be homogenous(additional element h) for matrix multiplication. Although it is not required unless for translation, I decided to do that so it can be easily be exented to support other transformation in future.

Instructions

  1. Compile and Run:
    clang++ -o transformations transformations.cpp
    ./transformations 
  2. Example Usage:
    • Enter the transformation angle (in degrees) and scaling factor when prompted.

Example Output

Original Box:
...
Rotated about X axis by 90 degrees:
...
Scaled by factor of 2:
...

treeleaf_cpp's People

Contributors

sandeshkhadka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.