Suppose I have two smooth projective varieties $X$ and $Y$ in $\mathbb{P}^n$, that intersect along a smooth subvariety $Z$. Is there a formula to compute the degree of the join variety $J(X,Y)$ of $X$ and $Y$? Of course if $Z$ is $\emptyset$ then we have the classical formula, but what if $Z$ is nonempty?

3$\begingroup$ The join $J(X,Y)$ is the (linear) projection of the abstract join of $X$ and $Y$ in $\mathbb{P}^{2n+1}$, so the question reduces to the question  how is the degree of a variety related to the degree of its linear projection. $\endgroup$– SashaAug 5, 2019 at 10:36
1 Answer
You can find a lot of material on the intersection theory of join varieties (including all that I write in this answer) in the conference paper [2] of Flenner. At the end of the second page (p.130) you find the statement of the general formula for the degree of joins: $$\deg X \deg Y = \deg V + \deg \pi \deg J,$$ The notation is as follows:
 $X,Y\subseteq \mathbb P^n$ are projective (irreducible) subvarieties, over an arbitrary field $K$;
 $V$ is their Vogelcycle, which is a special cycle supported on $X\cap Y$;
 $J\subseteq \mathbb P^n$ is their embedded join;
 $\pi:\tilde J \to J$ is the (rational) projection from the abstract join $\tilde J\subseteq \mathbb P^{2n+1}$ of $X$ and $Y$.
This formula is a consequence of the correspondence principle of van Gastel [3] and of the intersection theory of Stückrad and Vogel [4]. Remarkably, it is valid regardless of the dimension of $J$. The paper of Flenner also explains how to express the Vogelcycle (and so also the degree of $J$) in terms of Segre classes, cf [1].
 Ådlandsvik B.: Joins and higher secant varieties. Mathematica Scandinavica (1987) 61:213222.
 Flenner H.: Join Varieties and Intersection Theory pp.129197. In: Ellingsrud G., Fulton W., Vistoli A. (eds) Recent Progress in Intersection Theory. Trends in Mathematics, Birkhäuser 2000.
 Gastel, L.J. van: Excess intersections and a correspondence principle. Inventiones Mathematicae (1991) 103:197–221.
 Stückrad J., Vogel, W.: An algebraic approach to the intersection theory pp.132. In: The curves seminar at Queen's Vol II. Queen's papers in pure and applied mathematics No.61, Kingston 1982.