141 questions
0
votes
1
answer
89
views
How can I create triangles and squares with a for loop?
I used this method to draw squares and triangles on the paint box:
procedure squarClick(Sender: TObject);
begin
canvas.Pen.Color := clgreen;
canvas.Pen.Style := psSolid;
canvas.Pen.Width :...
1
vote
1
answer
61
views
Experiencing Infinite Loop with Right Triangle Program in MASM Assembly Language
I'm currently trying to make a program in MASM assembly language that will print out a series of right triangles based on an integer value that the user inputs. For example, if the user input is 3 ...
0
votes
0
answers
28
views
Double values for triangle angles returning as NaN if 2+ side lengths are the same
I'm trying to write a program that will calculate the angles of a triangle using the side lengths (via the Law of Cosines, Law of Sines, and Triangle Sum Theorem). It works just fine if all the side ...
0
votes
0
answers
164
views
Segmentation fault when using 'triangle' library ONLY when processing multiple geometries in loop
I am trying to process shapely polygon geometries and decompose them into triangles with the constraint that triangle vertices can only exist on the polygon edge(s).
For some strange reason the code ...
0
votes
2
answers
63
views
non-symmetrical elements in two groups that should be symmetrical
I am using Gmsh to generate a mesh that should be symmetric. I expected mesh in the Curve Loop (6) and Curve Loop (7) are symmetrical. But in fact, they are not as can be seen in the figure. Could ...
2
votes
1
answer
64
views
Finding the inside of a floating triangle
Using Visual Studio 2017 and OpenFrameworks
I've drawn a triangle as follows:
ofDrawTriangle(ofPoint(0, -fHigh / 2, 0),
ofPoint(fWide / 2, fHigh / 2, 0),
ofPoint(-fWide ...
1
vote
0
answers
36
views
WebGL output buffers not working as expected
When I use my code:
`const gl = WebGL.gl;
const programInfo = WebGL.programInfo;
const fieldOfView = (this.camera.FOV * Math.PI) / 180; // Convert FOV to radians
const aspect = ...
0
votes
1
answer
80
views
Creating Loop for Triangles
I have multiple objects that I created which include data I need for each triangle. I now want to create triangles and export to csv, but I have so many datasets that I'd like to do this in a loop. ...
1
vote
2
answers
82
views
Printing triangle of stars in java using recursion with restrictions
We are trying to create a triangle of stars using java, but the restrictions are that you cannot use any loops, extra methods, add extra parameters, add extra variables, or even use string methods. ...
0
votes
1
answer
57
views
Triangles (CSS) that Grow with the Inside Text?
So my client is interested in creating a hover effect for captions/links as shown in the below mockup:
The problem with CSS triangles (as I know it) is that it doesn't grow with the text. While it is ...
0
votes
2
answers
224
views
Alphabetical Pyramid
I'm trying to make a program that takes input number of rows from the user and prints this type of pattern for example if "number of rows: 5", then it should print this pattern
OUTPUT I WANT
...
0
votes
1
answer
73
views
How do I add a newline symbol in the middle of each triangle output, and without a newline symbol after the last triangle output?
How do I add a newline between two triangles and without a newline at the end of the triangle?
Sample Input
4↵
5↵
Sample Output
*******↵
*****↵
***↵
*↵
↵
*↵
***↵
*****↵
*******↵
...
-1
votes
1
answer
35
views
changing graphing symbols in VB.net
What do I need to call to change my symbols in a Fastpoint VB.net chart? It auto selects circles squares triangles and diamonds at random. However, I am needing them all to be diamonds and or ...
0
votes
1
answer
121
views
Memory read access violation when using Triangle mesh generation library in C++ project
I'm trying to use J. Shewchuk's mesh generation library Triangle in a C++ program. To do this I first downloaded triangle.h and triangle.c from the Triangle website. Then, in triangle.c I included ...
0
votes
0
answers
41
views
Highlighting a mesh triangle on mouse click
I would like to change the color of a mesh triangle when I click on it. The following code is not working. When I draw a debug line then the correct triangle is highlighted, but the color is not ...
0
votes
1
answer
147
views
MARIE, multiply 2 numbers and divide final result by 2
/len = length, hei = height
/get and store input
input
store LEN
input
store HEI
/start of loop
/load in the value of len
LOOP, load LEN
/add len to num
add NUM
/store the value in num
Store NUM
/...
-1
votes
1
answer
65
views
About triangles in HTML, I saw solutions using borders, translate, etc, but no one solving this issue: how to set a link only to the triangle area? [duplicate]
I want to create a triangle and set a link (changing cursor etc) only to the visible area of this triangle, leaving the transparent area untouched and unlinked.
All the solutions here, I tried to ...
1
vote
1
answer
64
views
Assembler that reads 3 decimal numbers L1,L2,L3 two digits mostly then indicate whether these numbers can represent the sides of a triangle
L2+L3>= L1 et L2+L1>= L3 et L1+L3>= L2 are the 3 conditions that must be verified to admit if it's a triangle or not. I tried the code below but it's giving me wrong answers and I'd like to ...
0
votes
1
answer
62
views
CSS Drawn Triangles are not matching in line
I tried to put CSS-drawn triangles in a table, but the points are not matching. (Please find attached picture)
Does anybody know how to achieve it without a canvas?
It also changes with the zoom ...
0
votes
1
answer
115
views
MATLAB - generating a 2d triangle aperture for diffraction
I have a logical square array such that a value of 1 signifies that light is allowed to pass through the array at those points, and a value of 0 means that light is blocked.
How do I create a ...
1
vote
1
answer
540
views
In trimesh, how to get the triangle id given a point location and the mesh?
Using trimesh, I need to find the triangle id for a point given a triangular mesh. The point lies on an edge of the mesh or it may be a triangle vertex.
import trimesh
import numpy as np
mesh = ...
0
votes
2
answers
118
views
Is there a way to get a triangle to rotate to face the mouse on a circle?
I'm trying to make it so that a triangle, with its two base points always staying on the outer edge of a circle, will point towards where the mouse is. I'm convinced it's mostly a specific math ...
0
votes
1
answer
102
views
Detecting 3D Collisions
I am currently working on a lwjgl project where I need to detect collisions between 3D triangles. I'm using OpenGL, and I'm seeking guidance on the most efficient and accurate way to achieve this.
To ...
0
votes
1
answer
102
views
I am trying to compile this code in order to determine if a triangle can be formed using pythagorean theorem
/*This program determines whether a triangle can be formed and whether it is a right triangle or not*/
import java.util.Scanner;
public class TriangleFormation {
//Function to calculate for ...
0
votes
1
answer
2k
views
trying to print degree symbol after integer
I am trying to do the find-angle challenge in hacker rank, I got the value of the angle as an integer but hacker rank requires me to give the output with " ° " symbol at the end, how do I ...
0
votes
1
answer
251
views
Error while build triangle from source: c1: fatal error C1083: Cannot open source file: 'c/triangle.c': No such file or directory
I am getting this error while trying to build triangle (The source file can be accessed from here: https://github.com/drufat/triangle) from source:
`
c1: fatal error C1083: Cannot open source file: 'c/...
0
votes
2
answers
168
views
Fast, but not necessarily pinpoint accurate, closest point on 3D triangle?
I have a case where I need to find the closest point to a sphere's center on a LOT of triangles. However, the accuracy isn't quite so important... it needs to be vaguely accurate, but an error rate ...
0
votes
2
answers
215
views
Half of the triangles of the custom mesh is not created Unity?
I generate a world and record it inside a grid map. Then I draw this map by programmatically drawing a mesh. However when I generate a bigger map half of it is missing. Is there a triangle limit on ...
1
vote
1
answer
198
views
3d triangle approximation with rectangular prisms
I am trying to approximate 3d triangles with rectangular prisms but I cant figure out the math
Im using lua
Ive tried flattening the triangle to a 2d plane and approximating the triangles with normal ...
0
votes
2
answers
72
views
Making a triangle using the turtle but the sides don't connect at the end
import numpy as np
import math as m
import turtle as t
s=[3, 4, 5]
#expression below is used to calculate the angle between two sides of a triangle
a1=m.degrees(np.arccos(((s[1]**2 + s[2]**2 - s[0]**...
1
vote
1
answer
359
views
How to draw a triangle in qt 3d on a Qt3DExtras::Qt3DWindow?
I'm trying to draw a triangle in qt6 3d, but i got this error in console... Notice that in my project i'm drawing other objects using the classic mesh classes from Qt and everything works perfect..
...
1
vote
5
answers
331
views
How can I do an empty triangle with stars in c++ to after do the British flag?
This is the flag that I have to get at the end:
*******************
** * **
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * ...
0
votes
1
answer
877
views
WebGPU. How to draw the Triangle Strip with different color for each Triangle?
The first triangle must be RED,
the second triangle must be GREEN.
But both are GREEN (((
How to set different colors for each sub-triangle in 'triangle-strip' primitive topology ?
My final goal is: ...
0
votes
1
answer
273
views
Generating a mesh in Unity: How do I set triangle vertices to align with points from the next GameObject?
I want to generate a mesh in Unity. I have GameObjects (segments) that contain GameObjects (points).
To create a triange mesh, I set two of the three triangle vertices to the two points of the current ...
0
votes
1
answer
275
views
How to find triangle Height with 2 points and Length?
I'm trying to figure out how to get the Height of a triangle:
I have startPoint, endPoint and Length:
Point startPoint = Start.GetPoint();
Point endPoint = End.GetPoint();
double Length = panel.W + ...
0
votes
1
answer
156
views
I've been getting Exception in thread "main" java.lang.ArrayOutOfBoundsException: 2 error on most of my java programs. How should I fix this?
I am new to programming. I've been in a class for a week now and I am stuck on this problem for most of my java programs. There was an exception for one of the programs where the code executed ...
0
votes
1
answer
69
views
Recursive function to create triangle
what is wrong with my code to generate the folowing output. I need to use recursive function to complete the program but I get the wrong output.
def computeTriangle(levels):
`
if levels == 0:
...
0
votes
1
answer
216
views
Removing Triangles of mesh having Cloth component
I have implemented the remove triangle for removing selected triangles using raycast in unity. My implementation works fine with mesh in having no components of cloth but when I am adding the cloth ...
0
votes
1
answer
38
views
why is the filling value always equal to 'True' , and why can't I set the value for the parent class's attributes using the child's constructor
The goal was to design a class named "Triangle" , that extends from the class "GeometricObject" , the overall code works fine and has no errors but the problem is that the "...
-1
votes
1
answer
447
views
How to fit/clip an axis aligned bounding box around a portion of a triangle
I have looked and looked and cannot find any resources on. I want to clip an axis aligned bounding box against a triangle in a way that creates a new tight fitting axis aligned bounding box around or ...
2
votes
0
answers
189
views
Can't find correct MTV(Minimum Translation Vector) of AABB/Triangle Intersection
My MTV (Minimum Translation Vector) in AABB/Triangle intersection gives incorrect result on corners by Y axis. How can I fix it?
Current result:
This is my code:
public static bool ...
0
votes
3
answers
458
views
How can I avoid rounding off values in C?
i update my code for this :
#include <stdio.h>
int IsRightTriangle(float x,float y,float z )
{
int result;
if( ((x*x)+(y*y)-(z*z)>0.999 && (x*x)+(y*y)-(z*z)<1) ||...
3
votes
2
answers
287
views
How to calculate coordinates of 6 point of intersection between a circle and a equilateral triangle?
I know of an equilateral triangle the center (cx,cy) and the radius (r) of a blue circle which circumscribed it.
If I draw a green circle of any radius (radius), assuming the circle is large enough to ...
0
votes
0
answers
87
views
How to print Paskal's Triangle in Java [duplicate]
Can I print this with triangle shape in Java?
I tried to print this with only border "1"s:
int[][] matrix = new int[5][5];
for (int i = 0; i < 5; i++) {
matrix[i][i] = 1;
matrix[...
-3
votes
2
answers
569
views
printing triangle using recursion in c without loop or multiplication
I'm supposed to print a triangle int tri(int rows) in c using recursion without multiplication or loops. The triangle should have one * in the 1st row, two ** in the 2nd row, three *** in the 3rd row ...
1
vote
3
answers
296
views
Finding total amount of paths in a triangle grid (iterative without recursion)
i have a given a triangle grid:
Triangle
For every point (i,j) with i+j being even:
Given recursive function
Now i need to write a iterative function that finds all possible paths from (0,0) to the ...
0
votes
1
answer
238
views
How to draw a triangle given two points using an html canvas and typescript
I am sure I have missed something obvious, but I am trying to draw a quadratic curve between two points using an html canvas, for which I need a 'control point' to set the curve. The start and end ...
1
vote
2
answers
182
views
C For Loop Floyd's Triangle but different?
I need help on how to do a Flyod's Triangle style but instead of input value in rows, the triangle is based on the input value as a whole.
instead of;
Enter a number: 9
1
2 3
4 5 6
7 8 9 10
11 12 ...
0
votes
1
answer
743
views
Fuzzy logic membership functions
I have 2 types of fuzzy function => triangle and trapazoid .. the triangle function take value and 3 points ( a,b,c's of triangle) and the trapazoid take value and 4 points ( a,b,c,d's of trapazoid ...
0
votes
1
answer
83
views
How to set different color to the neighboring color of selected triangle?
I am trying to implement a method using ray casting in unity where I can set different color to selected face of triangle and set different color to the contacted triangle (neighboring triangles) but ...