Draft: Curva di Bézier cubica

From FreeCAD Documentation
Revision as of 21:02, 12 September 2019 by Renatorivo (talk | contribs) (Created page with "{{Emphasis|Vedere anche:}} Draft API e Nozioni di base sugli script di FreeCAD.")

This documentation is not finished. Please help and contribute documentation.

GuiCommand model explains how commands should be documented. Browse Category:UnfinishedDocu to see more incomplete pages like this one. See Category:Command Reference for all commands.

See WikiPages to learn about editing the wiki pages, and go to Help FreeCAD to learn about other ways in which you can contribute.


Curva di Bézier cubica

Posizione nel menu
Draft → Strumenti Bezier → Curva di Bézier cubica
Ambiente
Draft, Arch
Avvio veloce
Nessuno
Introdotto nella versione
-
Vedere anche
Polilinea, B-spline, Curva di Bézier

Descrizione

Lo strumento Curva di Bézier cubica crea unaCurva di Bézier di terzo grado. Questa è una delle curve di Bezier più usate. Questo strumento consente di creare una grande spline composta da diversi segmenti Bezier di 3° grado, in un modo simile allo strumento Bezier in Inkscape. Una curva di Bezier di qualsiasi grado può essere creata con lo strumento Curva di Bézier.

Gli strumenti Curva di Bézier e Curva di Bézier cubica utilizzano i punti di controllo per definire la direzione della curva; invece lo strumento B-spline specifica i punti esatti attraverso i quali passa la curva.

File:Cub bez curve.png

Curva di Bézier cubica definita da tre punti di controllo

Utilizzo

  1. Premere il pulsante Curva di Bézier cubica.
  2. Fare clic su un primo punto nella vista 3D e tenere premuto il puntatore del mouse.
  3. Trascinare il puntatore su un altro punto della vista 3D e rilasciare il puntatore.
  4. Spostare il puntatore su un altro punto della vista 3D per regolare la curvatura della spline, fare clic e tenere premuto sul punto.
  5. Spostare il puntatore su un altro punto della vista 3D per regolare la curvatura finale della spline, quindi rilasciare il puntatore. Questo crea una curva di Bezier di 3° grado. Continuare a disegnare dall'ultimo punto.
  6. Ripetere il processo di fare clic, tenere premuto, trascinare e rilasciare per aggiungere punti e creare ulteriori segmenti Beziér di terzo grado.
  7. Premere Esc o il pulsante Chiudi per completare l'edizione.

Opzioni

Proprietà

Dati

Vista

Script

Vedere anche: Draft API e Nozioni di base sugli script di FreeCAD.

See Draft BezCurve for the general information information. A cubic Bezier is created by passing the option degree=3 to makeBezCurve().

For each cubic Bezier segment four points must be used, of which the two intermediate points are the control points.

  • If only 3 points are given, it creates a quadratic Bezier instead.
  • If only 2 points are given, it creates a linear Bezier, that is, a straight line.
  • If 5 points are given, the first 4 create a cubic Bezier segment; the fourth and the fifth points are used to create a straight line.
  • If 6 points are given, the first 4 create a cubic Bezier segment; the fourth and the other two points are used to create a quadratic Bezier segment.
  • If 7 points are given, the first 4 create a cubic Bezier segment; the fourth and the other three are used to create a second cubic Bezier segment.
  • That is, whenever possible, the last point in a cubic Bezier is shared withe following points.

Esempio:

import FreeCAD as App
import Draft

p1 = App.Vector(-3500, 0, 0)
p2 = App.Vector(-3000, 2000, 0)
p3 = App.Vector(-1100, 2000, 0)
p4 = App.Vector(0, 0, 0)

p5 = App.Vector(1500, -2000, 0)
p6 = App.Vector(3000, -1500, 0)
p7 = App.Vector(5000, 0, 0)
rot = App.Rotation()

Draft.makeCircle(100, placement=App.Placement(p1, rot), face=False)
Draft.makeCircle(50, placement=App.Placement(p2, rot), face=True)
Draft.makeCircle(50, placement=App.Placement(p3, rot), face=True)
Draft.makeCircle(100, placement=App.Placement(p4, rot), face=False)
Draft.makeCircle(50, placement=App.Placement(p5, rot), face=True)
Draft.makeCircle(50, placement=App.Placement(p6, rot), face=True)
Draft.makeCircle(100, placement=App.Placement(p7, rot), face=False)

B1 = Draft.makeBezCurve([p1, p2], degree=3)
B1.ViewObject.DrawStyle = "Dashed"

B2 = Draft.makeBezCurve([p1, p2, p3], degree=3)
B1.ViewObject.DrawStyle = "Dotted"

B = Draft.makeBezCurve([p1, p2, p3, p4], degree=3)
B3 = Draft.makeBezCurve([p1, p2, p3, p4, p5, p6, p7], degree=3)
App.ActiveDocument.recompute()