- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes

- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages

- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation

- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples

# How to Homogenize a Point in Java?

In this article we will see how to homogenize a point. Any point in the projective plane is represented by a triple (X, Y, Z), called homogeneous coordinates or projective coordinates of the point, where X, Y and Z are not all 0. The point represented by a given set of homogeneous coordinates is unchanged if the coordinates are multiplied by a common factor.

As per the problem statement we have to homogenize a point by taking any common factor and multiplying it with the given points.

Let’s start!

### To show you some instances

### Instance-1

Suppose the points are (10, 20, 25)

Then the common factor of the points are 5, 10.

Suppose we take the greatest common factor i.e., 10 to homogenize the given points.

Then after homogenizing the point, result will be −

The homogeneous points are: (100, 200, 250)

### Instance-2

Suppose the points are (8, 16, 12)

Then the common factors of the points are 2, 4.

Suppose we take the greatest common factor i.e., 4 to homogenize the given points.

Then after homogenizing the point, result will be

The homogeneous points are: (32, 64, 48)

### Instance-3

Suppose the points are (12, 16, 20)

Then the common factors of the points are 2, 4.

Suppose we take the greatest common factor i.e., 4 to homogenize the given points.

Then after homogenizing the point, result will be

The homogeneous points are: (48, 64, 80)

### Algorithm

**Step 1** − Declare and initialise the variables.

**Step 2** − Declare the common factor.

**Step 3** − Declare the points.

**Step 4** − Find the homogeneous points by multiplying the common factor.

**Step 5** − Print the result.

### Multiple Approaches

We have provided the solution in different approaches.

By Using Static Input

By Using User Defined Method

Let’s see the program along with its output one by one.

## Approach-1: By Using Static Input

In this approach, we will declare the points, and common factor and then we will find homogeneous points by multiplying the common factor.

### Example

public class Main{ //main method public static void main(String[] args){ //initialising the variables int x, y, z; //declaring the common factor int a = 10; //declaring the points int a1 = 10, a2 = 20, a3 = 25; //finding the homogeneous points x = a * a1; y = a * a2; z = a * a3; //print the result System.out.println("Homogeneous points: (" + x + ", " + y + ", " + z + ")"); } }

### Output

Homogeneous points: (100, 200, 250)

## Approach-2: By Using User Defined Method

In this approach, we will declare the points, and common factor and then we will find homogeneous points by multiplying the common factor using a user-defined method.

### Example

public class Main{ //main method public static void main(String[] args){ //declaring the points int a1 = 8, a2 = 16, a3 = 12; //calling user defined method func(a1, a2, a3); } //user defined method static void func(int a1, int a2, int a3){ //initialising the variables int x, y, z; //declaring the commom factor int a = 4; //finding the homogeneous points x = a * a1; y = a * a2; z = a * a3; //print the result System.out.println("Homogeneous points: (" + x + ", " + y + ", " + z + ")"); } }

### Output

Homogeneous points: (32, 64, 48)

In this article, we explored how to homogenize a point by using Java programming language.

- Related Articles
- How To Check if a Given Point Lies Inside a Rectangle in Java?
- Floating-point hexadecimal in Java
- How to make a multicolored point in Matplotlib?
- Apply modulus operator to floating-point values in Java
- Check if a Point Exists in Circle Sector in Java
- Format floating point number in Java
- Floating-point conversion characters in Java
- How to create a point chart with point size increment based on the position of the point in R?
- How to convert a string to a floating point number in JavaScript?
- How to Automatically Insert a Decimal Point to a Number in Excel?
- How to create and release a save point in JDBC?
- How to plot a point on 3D axes in Matplotlib?
- Floating point operators and associativity in Java
- Java program to multiply given floating point numbers
- Java Program to Multiply Two Floating-Point Numbers