Ich habe die Bezier -Kurve in Openentk erstellt. Ich erhalte ein Ergebnis, aber wie Sie sehen können, dass sie nicht glatt und regelmäßig ist. Ich weiß immer noch nicht, wie es glatt wird. Onload < /p>
Ich habe die Bezier -Kurve in Openentk erstellt. Ich erhalte ein Ergebnis, aber wie Sie sehen können, dass sie nicht glatt und regelmäßig ist. Ich weiß immer noch nicht, wie es glatt wird. Onload < /p> [code]float[] Vertices = { -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, };
InterpolatedVertices = Interpolation.Quadratic( (Vertices[0], Vertices[1]), (Vertices[2], Vertices[3]), (Vertices[4], Vertices[5]), 1000, 0.01f ); < /code> Dies ist der Code zum Zeichnen < /p> GL.DrawArrays(PrimitiveType.Points, 0 , 1000); < /code> Dies ist mein Code für die lineare und quadratische Interpolation < /p> public static (float, float) Linear((float, float) start, (float, float) end, float t) { // Clamp t between 0 and 1 t = t > 1 ? 1 : t < 0 ? 0 : t;
// Calculate the new coordinates (Offset + (Distance * t)) float x = MathF.Round(start.Item1 + (end.Item1 - start.Item1) * t, 2); float y = MathF.Round(start.Item2 + (end.Item2 - start.Item2) * t, 2);
return (x, y); }
public static (float, float) Quadratic((float, float) start, (float, float) controlPoint, (float, float) end, float t) { // Interpolate Start and ControlPoint var firstInterpolated = Linear(start, controlPoint, t);
// Interpolate ControlPoint and End var secondInterpolated = Linear(controlPoint, end, t);
// Interpolate the two interpolated points var result = Linear(firstInterpolated, secondInterpolated, t);
return result; }
public static float[] Quadratic((float, float) start, (float, float) controlPoint, (float, float) end, int intensity, float t) { float[] interpolatedPoints = new float[intensity * 2]; float stride = t;
for (int i = 0; i < intensity * 2; i += 2) { var point = Quadratic(start, controlPoint, end, stride); interpolatedPoints[i] = point.Item1; interpolatedPoints[i + 1] = point.Item2; stride += t; }
Ich versuche, ein System zum Erstellen eines Netzes auf einer Bezier -Kurve zu erstellen. Alles scheint geklappt zu haben, aber beim Versuch, die UV -Koordinaten zu berechnen, treten Kuriositäten...
Wenn ich eine Bezier-Kurve habe, wie kann ich ihr eine Breite geben und wie erhalte ich Scheitelpunkte ihrer Kontur?
Mein Versuch: Ich habe eine Bezier-Kurve gezeichnet, indem ich eine solche Kurve...
Ich arbeite an einer Windows Forms-Anwendung, in der ich Code implementiert habe, um die Ecken des Formulars zu krümmen. Während der Code das Formular selbst erfolgreich krümmt, funktioniert er nicht...
Erstellen einer serverseitigen Implementierung, um die Solana-Verifizierung für einen Vertrag durchzuführen, wenn wir eine Solana-Adresse erhalten ( Ed25519 öffentlicher Schlüssel) vom Client. Sie...