Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:02:45+00:00 2026-06-12T05:02:45+00:00

How to render 2D shape of points in three.js? I didnt find any working

  • 0

How to render 2D shape of points in three.js? I didnt find any working geometry… I just need to make polygon of points that are in the same plane.

Shape isnt right for that as it supports only 2D coords and I need to use 3D points…

I am using the following code to create shape within the X,Y plane

 var squareShape = new THREE.Shape();
 squareShape.moveTo( 0,0 );
 squareShape.lineTo( 0, 50 );
 squareShape.lineTo( 20, 80 );
 squareShape.lineTo( 50, 50 );
 squareShape.lineTo( 0, 0 );

How to make in work it 3D world? Any solution? like:

squareShape.moveTo( 0,0,0 );
squareShape.lineTo( 0, 50, 50 );

etc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:02:46+00:00Added an answer on June 12, 2026 at 5:02 am

    You need to create a geometry with the shapes’ vertices (after extraction) and use triangulation to make the faces.

    The code should look something like this:

    var geometry = new THREE.Geometry();
    var shapePoints = shape.extractPoints();
    var faces = THREE.Shape.Utils.triangulateShape(shapePoints.shape, shapePoints.holes);
    for (var i = 0; i < shapePoints.shape.length; i++) {
        geometry.vertices.push(new THREE.Vector3(shapePoints.shape[i].x, 0, shapePoints.shape[i].y));
    }
    for (var i = 0; i < faces.length ; i++) {
        var a = faces[i][2] , b = faces[i][1] , c = faces[i][0] ;
        var v1 = shapePoints.shape[a], v2 = shapePoints.shape[b], v3 = shapePoints.shape[c];
    
        geometry.faces.push( new THREE.Face3(a, b, c) );    
        geometry.faceVertexUvs[0].push(
            [ new THREE.UV(v1.x ,v1.y ), new THREE.UV(v2.x, v2.y), new THREE.UV(v3.x, v3.y)]);
    }
    geometry.computeCentroids();
    geometry.computeFaceNormals();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I create a Polygon layer with points: [{lat:51.509,lng:-0.08},{lat:51.503,lng:-0.06},{lat:51.51,lng:-0.047},{lat:51.500,lng:-0.039}] , I get something that
If you begin to render points, render a ton of vertices, and then end,
Shape.h namespace Graphics { class Shape { public: virtual void Render(Point point) {}; };
I have a series of shapes (Approx. 50), that each have 5 points, and
I need to be able to render some views as PDFs from a Rails
All, I'm working on a web application for iOS that uses a fixed position
I want to create Json object by getting points of a shape file in
In raphael , if I want to render the following shape: I have to
What's the easy way to render a shape in Java to its actual size.
I can render a node with the help of either: LabelRenderer (that shows the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.