Unable to generate a three-dimensional plane on the XZ plane

When using the Aframe library to create a plane, I defined the following points:

point_1 = [0, 0, 0]; point_2 = [1, 0, 0]; point_3 = [1, 1, 0]; point_4 = [0, 1, 0];

To generate a plane in the XY plane, everything functions as expected. Here is the working code: https://jsfiddle.net/qtv10291/yp4mx6re/8/ However, when I modify the points to:

point_1 = [0, 0, 0]; point_2 = [1, 0, 0]; point_3 = [1, 0, 1]; point_4 = [0, 0, 1];

In an attempt to create a plane in the XZ plane, it fails and displays the error THREE.DirectGeometry: Faceless geometries are not supported.. Here is the problematic code: https://jsfiddle.net/qtv10291/49gvwL8a/

Answer №1

Shape is limited to 2D and only processes points with coordinates in the form of (x, y). The third dimension of the points provided is disregarded.

If you wish to generate an XZ plane, you can either rotate the XY plane by 90 degrees:

const geometry = new THREE.ShapeGeometry( polygon );
geometry.rotateX(-Math.PI * 0.5);

Alternatively, you can create it using vertices and faces:

const geometry = new THREE.Geometry();
geometry.vertices = points;
geometry.faces.push( new THREE.Face3( 2, 1, 0 ), new THREE.Face3( 2, 0, 3 ) );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Angular interfaces fail to load on every web browser

I am encountering an issue with my Angular and Bootstrap application where the pages are not loading. Despite checking all hooks, I am unable to identify the problem. You can access the site here. The enablers, contact, and create account buttons have be ...

How can you refresh the source element?

Is there a way to make the browser reload a single element on the page (such as 'src' or 'div')? I have tried using this code: $("div#imgAppendHere").html("<img id=\"img\" src=\"/photos/" + recipe.id + ".png\" he ...

Steps to adding a collection of links (stylesheets, javascript files) to each html document

Is it feasible to add a list of links to multiple HTML files? I was inspired by W3 School's W3 Include functionality, which allows you to import blocks of HTML code into various files simultaneously, making it convenient for making changes across many ...

Exploring recommendations using AngularJS

I am currently working on replicating the search suggestion feature found at: where certain words are displayed as you type in the search box. Here is my HTML setup: <form ng-controller="SearchCtrl"> <input name="q" ng-model="query" ng-keyp ...

How PHP Processes Fragment Identifiers within URLs

Looking for some advice from the community on a tricky situation I'm facing. Here's the issue at hand: I have developed a website with dynamic content pulled via AJAX and displayed using JS. To allow direct links to my content, I modify the frag ...

Exploring the power of AngularJS through JSON with multidimensional arrays

My goal is to construct a multidimensional array capable of storing 6 JSON responses. To seek guidance, I have consulted other resources such as this thread on multidimensional arrays in Angular. However, upon testing my console log for the multidimension ...

JavaScript - The AJAX response is consistently after being undefined

I am encountering an issue with the following functions: function get_non_authorized_bulk_edit_option_values() { var modificable_column_names = get_write_user_values(); alert(modificable_column_names); } The above function is calling this ...

Validating the body in Node.js for POST and PUT requests

When working in a production setting, what is considered the standard for POST / PUT body validation? I typically approach it like this: const isValid = (req.body.foo && /[a-z0-9]*/i.test(req.body.foo)) This method involves checking that the var ...

I'm currently attempting to incorporate the Material-UI InfoIcon into my code, but I'm unsure of how to properly integrate it within a TextField component

I am attempting to integrate the Material-UI InfoIcon into my TextField code, but I'm unsure of how to go about it. Here is the snippet of Material-UI code: <InfoIcon fontSize="small" /> This is where I would like to place it: <Grid item ...

The submit button fails to function properly in the presence of multiple fields

Encountering an issue where the Submit button becomes unresponsive when multiple addresses are generated. To resolve this, I attempted to use JavaScript. @foreach ($userDetails as $addr) <div class="order_container"> <input type="hid ...

Is there a way to determine if a unique value is present in a jQuery array?

$.each(date_range, function(kr, time) { alert('time' + '=>' + time) alert(data_d.indexOf(time) != -1); if (time == timestamp) { data_d.push([timestamp, v.kreditbetrag]); } else { data_d.push([time, 0] ...

Preserve aspect ratio when applying a texture map to a threejs object

I have a project idea to develop a 3D shoe design tool that allows users to create patterns and apply them to the shoes. I am facing an issue with adding an image to a Three.js material. The texture appears blurry after updating it. As a beginner in Three ...

Retrieving JSON data through HttpClient in Angular 7

I am attempting to retrieve information from this specific URL. The data obtained from this URL is in JSON format. This particular file is named data.services.ts: import { Injectable } from '@angular/core'; import { HttpClient } from '@an ...

Generate a responsive list with a pop-up feature under each item (using Vue.js)

Currently, I believe that Vue may not be necessary since most tasks can be done using JavaScript and CSS. I am attempting to design a list layout as follows: [A] [B] [C] [D] When an item is clicked, the information about that specific item should ...

Deciphering a PHP json_encode response using JavaScript

Consider this scenario where I am using json_encoding for my array and displaying it: $key = $this->key; $sql = "SELECT * FROM Requests"; $result = $this->db->query($sql); ...

How to nullify the valueChanges pipe in Angular RxJS until the observable is resolved

A challenge I am facing is piping the valueChanges from a select element to trigger the appropriate API request and displaying a spinner until the response is received. Additionally, I am trying to utilize publish() and refCount() methods so that I can use ...

What is the best way to set one property to be the same as another in Angular?

In my project, I have defined a class called MyClass which I later utilize in an Angular component. export class MyClass { prop: string; constructor(val){ this.prop = val; } public getLength(str: string): number { return str.length; } ...

Tips for maintaining the state in a React class component for the UI while navigating or refreshing the page

Is there a way to persist the selection stored in state even after page navigation? I have heard that using local storage is a possible solution, which is my preferred method. However, I have only found resources for implementing this in functional compone ...

"Attempting to send JSON data via JsonResult is unsuccessful when trying to send a JSON object directly or using JSON

In my project, I have a class that looks like this: I've created a JsonResult method in the controller which takes an object of this class as a parameter: [HttpPost] public JsonResult NewAreaCode(AreaCode model) { return Json ...

Steps for uploading an item to an API using an Excel document

I'm facing an issue where I am trying to send a large object along with an Excel file to an API. However, only my photo is being recognized and the object is not sent, resulting in an [object Object] error. I understand that this error occurs due to i ...